Skip to content

Switch to using GitHub Actions for CI #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 8, 2021
Merged
61 changes: 61 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on:
push:
branches: [master, staging, trying]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

We've mostly specified specific versions just to ensure there are no surprises when -latest next changes. Same deal applies to the deploy job below, though you could also make that a final and optional step in the build job, I don't mind either way.


strategy:
matrix:
rust:
- stable
- beta
- nightly
- 1.51.0 # Minimum supported rust version (MSRV)

steps:
- uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy

- name: Install additional tooling
run: |
bash ci/install.sh
echo "PATH=$PATH:$PWD/gcc/bin:$PWD/qemu" >> $GITHUB_ENV
env:
RUST_VERSION: ${{ matrix.rust }}

- name: Test
run: bash ci/script.sh

deploy:
runs-on: ubuntu-latest

needs: [build]

if: github.ref == 'refs/heads/master'

steps:
- uses: actions/checkout@v2

- name: Install mdbook
run: sh ci/install-mdbook.sh

- name: Build the book
run: mdbook build

- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: book
12 changes: 12 additions & 0 deletions ci/install-mdbook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh

set -eo pipefail


tag=$(git ls-remote --tags --refs --exit-code https://github.com/rust-lang/mdbook \
| grep -Eo 'v[0-9.]+$' \
| sort --version-sort \
| tail -n1)

curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- --git rust-lang/mdbook --tag $tag
9 changes: 1 addition & 8 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
set -euxo pipefail

main() {
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/rust-lang-nursery/mdbook \
| cut -d/ -f3 \
| grep -E '^v[0-9.]+$' \
| sort --version-sort \
| tail -n1)

curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- --git rust-lang-nursery/mdbook --tag $tag
sh ./ci/install-mdbook.sh

rustup target add thumbv7m-none-eabi

Expand Down
11 changes: 4 additions & 7 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ main() {
popd

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

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

# check that the disassembly matches
Expand Down Expand Up @@ -231,7 +231,7 @@ main() {

# # DMA
# NOTE(nightly) this will require nightly until core::pin is stabilized (1.33)
if [ $TRAVIS_RUST_VERSION = nightly ]; then
if [ $RUST_VERSION = nightly ]; then
pushd dma
cargo build --examples
popd
Expand Down Expand Up @@ -260,7 +260,4 @@ qemu_check() {
rm .stdout .stderr
}

# don't run this on successful merges
if [[ $TRAVIS_BRANCH != main || $TRAVIS_PULL_REQUEST != false ]]; then
main
fi
main