Skip to content

Commit 00d4b9a

Browse files
bors[bot]robyoungadamgreig
authored
Merge #72
72: Switch to using GitHub Actions for CI r=adamgreig a=robyoung I have tried to keep it functionally identical to the travis workflow. This is a bit tricky for me to test. There are some minor changes though. - Added MSRV of 1.51.0 - I just picked a version out of thin air here. - I could not see an easy way of preventing master branch runs for PRs that have passed so this should run on all. - For deploying to github pages I'm using a 3rd party action. It looks reasonable and just uses the default repo scoped token. Co-authored-by: Rob Young <[email protected]> Co-authored-by: Adam Greig <[email protected]>
2 parents 4d10be2 + ebc6f18 commit 00d4b9a

File tree

5 files changed

+120
-70
lines changed

5 files changed

+120
-70
lines changed

.github/bors.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
block_labels = ["needs-decision"]
22
delete_merged_branches = true
33
required_approvals = 1
4-
status = ["continuous-integration/travis-ci/push"]
4+
status = ["build"]

.github/workflows/ci.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, staging, trying]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-20.04
11+
12+
continue-on-error: ${{ matrix.experimental || false }}
13+
14+
strategy:
15+
matrix:
16+
rust:
17+
- stable
18+
- beta
19+
- nightly
20+
- 1.51.0 # Minimum supported rust version (MSRV)
21+
include:
22+
- rust: nightly
23+
experimental: true
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Install Rust
29+
uses: actions-rs/toolchain@v1
30+
with:
31+
profile: minimal
32+
toolchain: ${{ matrix.rust }}
33+
override: true
34+
components: rustfmt, clippy
35+
36+
- name: Install Python dependencies
37+
run: |
38+
pip3 install --user python-dateutil linkchecker
39+
40+
- name: Cache installed binaries
41+
uses: actions/cache@v1
42+
id: cache-bin
43+
with:
44+
path: ~/cache-bin
45+
key: cache-bin
46+
47+
- name: Install mdbook
48+
if: steps.cache-bin.outputs.cache-hit != 'true'
49+
uses: actions-rs/[email protected]
50+
with:
51+
crate: mdbook
52+
version: latest
53+
54+
- name: Install cargo-binutils
55+
if: steps.cache-bin.outputs.cache-hit != 'true'
56+
uses: actions-rs/[email protected]
57+
with:
58+
crate: cargo-binutils
59+
version: latest
60+
61+
- name: Install arm-none-eabi-gcc and qemu
62+
if: steps.cache-bin.outputs.cache-hit != 'true'
63+
run: |
64+
mkdir gcc
65+
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update \
66+
| tar --strip-components=1 -C gcc -xj
67+
cp gcc/bin/* ~/cache-bin
68+
69+
curl -L https://github.com/japaric/qemu-bin/raw/master/14.04/qemu-system-arm-2.12.0 \
70+
> ~/cache-bin/qemu-system-arm
71+
chmod a+x ~/cache-bin/qemu-system-arm
72+
73+
- name: Copy installed binaries to cache directory
74+
if: steps.cache-bin.outputs.cache-hit != 'true'
75+
run: |
76+
mkdir ~/cache-bin
77+
cp ~/.cargo/bin/* ~/cache-bin
78+
79+
- name: Put new bin directory into path
80+
run: echo "~/cache-bin" >> $GITHUB_PATH
81+
82+
- name: Test
83+
run: bash ci/script.sh
84+
env:
85+
RUST_VERSION: ${{ matrix.rust }}
86+
87+
deploy:
88+
runs-on: ubuntu-20.04
89+
90+
needs: [build]
91+
92+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
93+
94+
steps:
95+
- uses: actions/checkout@v2
96+
97+
- name: Cache installed binaries
98+
uses: actions/cache@v1
99+
id: cache-bin
100+
with:
101+
path: ~/cache-bin
102+
key: cache-bin
103+
104+
- name: Put new bin directory into path
105+
run: echo "~/cache-bin" >> $GITHUB_PATH
106+
107+
- name: Build the book
108+
run: mdbook build
109+
110+
- name: Deploy book
111+
uses: peaceiris/actions-gh-pages@v3
112+
with:
113+
github_token: ${{ secrets.GITHUB_TOKEN }}
114+
publish_dir: book
115+
force_orphan: true

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

ci/install.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

ci/script.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ main() {
8686
popd
8787

8888
# NOTE(nightly) this will require nightly until core::arch::arm::udf is stabilized
89-
if [ $TRAVIS_RUST_VERSION = nightly ]; then
89+
if [ $RUST_VERSION = nightly ]; then
9090
pushd app4
9191
cargo build
9292
qemu_check target/thumbv7m-none-eabi/debug/app
@@ -98,7 +98,7 @@ main() {
9898

9999
# # exception handling
100100
# NOTE(nightly) this will require nightly until core::arch::arm::udf is stabilized
101-
if [ $TRAVIS_RUST_VERSION = nightly ]; then
101+
if [ $RUST_VERSION = nightly ]; then
102102
pushd exceptions
103103

104104
# check that the disassembly matches
@@ -231,7 +231,7 @@ main() {
231231

232232
# # DMA
233233
# NOTE(nightly) this will require nightly until core::pin is stabilized (1.33)
234-
if [ $TRAVIS_RUST_VERSION = nightly ]; then
234+
if [ $RUST_VERSION = nightly ]; then
235235
pushd dma
236236
cargo build --examples
237237
popd
@@ -260,7 +260,4 @@ qemu_check() {
260260
rm .stdout .stderr
261261
}
262262

263-
# don't run this on successful merges
264-
if [[ $TRAVIS_BRANCH != main || $TRAVIS_PULL_REQUEST != false ]]; then
265-
main
266-
fi
263+
main

0 commit comments

Comments
 (0)