|
| 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, llvm-tools-preview |
| 35 | + target: thumbv7m-none-eabi |
| 36 | + |
| 37 | + - name: Install Python dependencies |
| 38 | + run: | |
| 39 | + pip3 install --user python-dateutil linkchecker |
| 40 | +
|
| 41 | + - name: Cache installed binaries |
| 42 | + uses: actions/cache@v1 |
| 43 | + id: cache-bin |
| 44 | + with: |
| 45 | + path: ~/cache-bin |
| 46 | + key: cache-bin |
| 47 | + |
| 48 | + - name: Install mdbook |
| 49 | + if: steps.cache-bin.outputs.cache-hit != 'true' |
| 50 | + uses: actions-rs/[email protected] |
| 51 | + with: |
| 52 | + crate: mdbook |
| 53 | + version: latest |
| 54 | + |
| 55 | + - name: Install cargo-binutils |
| 56 | + if: steps.cache-bin.outputs.cache-hit != 'true' |
| 57 | + uses: actions-rs/[email protected] |
| 58 | + with: |
| 59 | + crate: cargo-binutils |
| 60 | + version: latest |
| 61 | + |
| 62 | + - name: Install arm-none-eabi-gcc and qemu |
| 63 | + if: steps.cache-bin.outputs.cache-hit != 'true' |
| 64 | + run: | |
| 65 | + mkdir -p ~/cache-bin/arm_gcc |
| 66 | + curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.07/gcc-arm-none-eabi-10.3-2021.07-x86_64-linux.tar.bz2 \ |
| 67 | + | tar --strip-components=1 -C ~/cache-bin/arm_gcc -xj |
| 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 | + cp ~/.cargo/bin/* ~/cache-bin |
| 77 | +
|
| 78 | + - name: Put new bin directory into path |
| 79 | + run: | |
| 80 | + echo "$HOME/cache-bin" >> $GITHUB_PATH |
| 81 | + echo "$HOME/cache-bin/arm_gcc/bin" >> $GITHUB_PATH |
| 82 | +
|
| 83 | + - name: Test |
| 84 | + run: bash ci/script.sh |
| 85 | + env: |
| 86 | + RUST_VERSION: ${{ matrix.rust }} |
| 87 | + |
| 88 | + deploy: |
| 89 | + runs-on: ubuntu-20.04 |
| 90 | + |
| 91 | + needs: [build] |
| 92 | + |
| 93 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 94 | + |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@v2 |
| 97 | + |
| 98 | + - name: Cache installed binaries |
| 99 | + uses: actions/cache@v1 |
| 100 | + id: cache-bin |
| 101 | + with: |
| 102 | + path: ~/cache-bin |
| 103 | + key: cache-bin |
| 104 | + |
| 105 | + - name: Put new bin directory into path |
| 106 | + run: echo "$HOME/cache-bin" >> $GITHUB_PATH |
| 107 | + |
| 108 | + - name: Build the book |
| 109 | + run: mdbook build |
| 110 | + |
| 111 | + - name: Deploy book |
| 112 | + uses: peaceiris/actions-gh-pages@v3 |
| 113 | + with: |
| 114 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 115 | + publish_dir: book |
| 116 | + force_orphan: true |
0 commit comments