diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/build.yml | 417 |
1 files changed, 298 insertions, 119 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e5a90e..8da9867 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: # Run cargo fmt --check, includes macros/ style: name: style - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v1 @@ -36,7 +36,7 @@ jobs: # Compilation check check: name: check - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: target: @@ -45,11 +45,32 @@ jobs: - x86_64-unknown-linux-gnu toolchain: - stable - - 1.36.0 steps: - name: Checkout uses: actions/checkout@v2 + - name: Cache cargo dependencies + uses: actions/cache@v2 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-build- + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) uses: actions-rs/toolchain@v1 with: @@ -57,10 +78,6 @@ jobs: target: ${{ matrix.target }} override: true - - name: Disable optimisation profiles - if: matrix.toolchain == '1.36.0' - run: sed -i '/^\[profile.*build-override]$/,/^$/{/^#/!{/^$/!d}}' Cargo.toml - - name: cargo check uses: actions-rs/cargo@v1 with: @@ -68,10 +85,10 @@ jobs: command: check args: --target=${{ matrix.target }} - # Verify all examples + # Verify all examples, checks checkexamples: name: checkexamples - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: target: @@ -83,41 +100,109 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Cache cargo dependencies + uses: actions/cache@v2 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-build- + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} target: ${{ matrix.target }} override: true - - uses: actions-rs/cargo@v1 - with: - use-cross: false - command: check - args: --examples --target=${{ matrix.target }} --features __min_r1_43 + components: llvm-tools-preview - - name: cargo check -p homogeneous + - name: Check the examples + if: matrix.target == 'thumbv7m-none-eabi' + env: + V7: __v7 uses: actions-rs/cargo@v1 with: use-cross: false command: check - args: -p homogeneous --examples --target=${{ matrix.target }} + args: --examples --target=${{ matrix.target }} --features __min_r1_43,${{ env.V7 }} - - name: Install QEMU - run: | - mkdir qemu - curl -L https://github.com/japaric/qemu-bin/raw/master/14.04/qemu-system-arm-2.12.0 > qemu/qemu-system-arm - chmod +x qemu/qemu-system-arm + # Verify the example output with run-pass tests + testexamples: + name: testexamples + runs-on: ubuntu-20.04 + strategy: + matrix: + target: + - thumbv7m-none-eabi + - thumbv6m-none-eabi + toolchain: + - stable + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Cache cargo dependencies + uses: actions/cache@v2 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-build- + + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + override: true + components: llvm-tools-preview - - name: Setup arm-none-eabi-gcc - uses: fiam/arm-none-eabi-gcc@v1 + # Use precompiled binutils + - name: cargo install cargo-binutils + uses: actions-rs/install@v0.1 with: - release: '9-2019-q4' # The arm-none-eabi-gcc release to use. + crate: cargo-binutils + version: latest + use-tool-cache: true + + - name: Install QEMU + run: | + sudo apt update + sudo apt install -y qemu-system-arm - name: Run-pass tests run: | - # Add QEMU to the path + # Print the path echo $PATH - PATH=$(pwd)/qemu:$PATH + arm_example() { local COMMAND=$1 local EXAMPLE=$2 @@ -145,7 +230,7 @@ jobs: else cargo $COMMAND $CARGO_FLAGS fi - arm-none-eabi-objcopy -O ihex target/${{ matrix.target }}/$BUILD_MODE/examples/$EXAMPLE ci/builds/${EXAMPLE}_${FEATURES_STR}${BUILD_MODE}_${BUILD_NUM}.hex + cargo objcopy $CARGO_FLAGS -- -O ihex ci/builds/${EXAMPLE}_${FEATURES_STR}${BUILD_MODE}_${BUILD_NUM}.hex } mkdir -p ci/builds @@ -190,15 +275,13 @@ jobs: $td/pool.run grep 'foo(0x2' $td/pool.run grep 'bar(0x2' $td/pool.run - arm-none-eabi-objcopy -O ihex target/${{ matrix.target }}/debug/examples/$ex \ - ci/builds/${ex}___v7_debug_1.hex + cargo objcopy --example $ex --target ${{ matrix.target }} --features __v7 -- -O ihex ci/builds/${ex}___v7_debug_1.hex cargo run --example $ex --target ${{ matrix.target }} --features __v7 --release >\ $td/pool.run grep 'foo(0x2' $td/pool.run grep 'bar(0x2' $td/pool.run - arm-none-eabi-objcopy -O ihex target/${{ matrix.target }}/release/examples/$ex \ - ci/builds/${ex}___v7_release_1.hex + cargo objcopy --example $ex --target ${{ matrix.target }} --features __v7 --release -- -O ihex ci/builds/${ex}___v7_release_1.hex rm -rf $td @@ -256,17 +339,39 @@ jobs: # Check the correctness of macros/ crate checkmacros: name: checkmacros - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: target: - x86_64-unknown-linux-gnu toolchain: - stable - - 1.36.0 steps: - name: Checkout uses: actions/checkout@v2 + + - name: Cache cargo dependencies + uses: actions/cache@v2 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-build- + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) uses: actions-rs/toolchain@v1 with: @@ -274,10 +379,6 @@ jobs: target: ${{ matrix.target }} override: true - - name: Disable optimisation profiles - if: matrix.toolchain == '1.36.0' - run: sed -i '/^\[profile.*build-override]$/,/^$/{/^#/!{/^$/!d}}' Cargo.toml - - name: cargo check uses: actions-rs/cargo@v1 with: @@ -285,112 +386,175 @@ jobs: command: check args: --manifest-path macros/Cargo.toml --target=${{ matrix.target }} - # Run test suite for thumbv7m - testv7: - name: testv7 - runs-on: ubuntu-latest + # Run the macros test-suite + testmacros: + name: testmacros + runs-on: ubuntu-20.04 + strategy: + matrix: + target: + - x86_64-unknown-linux-gnu + toolchain: + - stable steps: - name: Checkout uses: actions/checkout@v2 - - name: Install Rust + + - name: Cache cargo dependencies + uses: actions/cache@v2 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.OS }}-build- + + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) uses: actions-rs/toolchain@v1 with: - toolchain: 1.36.0 - target: thumbv7m-none-eabi + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} override: true - - name: Disable optimisation profiles - run: sed -i '/^\[profile.*build-override]$/,/^$/{/^#/!{/^$/!d}}' Cargo.toml - - - uses: actions-rs/cargo@v1 + - name: cargo check + uses: actions-rs/cargo@v1 with: use-cross: false command: test - args: --test single --features __v7 + args: --manifest-path macros/Cargo.toml --target=${{ matrix.target }} - # Run test suite for thumbv6m - testv6: - name: testv6 - runs-on: ubuntu-latest + # Run test suite for thumbv7m + testv7: + name: testv7 + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 + + - name: Cache cargo dependencies + uses: actions/cache@v2 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.36.0 - target: thumbv6m-none-eabi + toolchain: stable + target: thumbv7m-none-eabi override: true - - name: Disable optimisation profiles - run: sed -i '/^\[profile.*build-override]$/,/^$/{/^#/!{/^$/!d}}' Cargo.toml - - uses: actions-rs/cargo@v1 with: use-cross: false command: test - args: --test single + args: --test single --features __v7 - # Verify all multicore examples - checkmulticore: - name: checkmulticore - runs-on: ubuntu-latest - strategy: - matrix: - target: - - x86_64-unknown-linux-gnu - toolchain: - - nightly + # Run test suite for thumbv6m + testv6: + name: testv6 + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 - - name: Install Rust ${{ matrix.toolchain }} with x86_64-unknown-linux-gnu - uses: actions-rs/toolchain@v1 + - name: Cache cargo dependencies + uses: actions/cache@v2 with: - toolchain: ${{ matrix.toolchain }} - target: x86_64-unknown-linux-gnu - override: true - - name: Install Rust ${{ matrix.toolchain }} with thumbv7m-none-eabi - uses: actions-rs/toolchain@v1 + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 with: - toolchain: ${{ matrix.toolchain }} - target: thumbv7m-none-eabi - override: true - - name: Install Rust ${{ matrix.toolchain }} with thumbv6m-none-eabi + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + + - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: ${{ matrix.toolchain }} + toolchain: stable target: thumbv6m-none-eabi override: true + - uses: actions-rs/cargo@v1 with: - command: install - args: microamp-tools --version 0.1.0-alpha.3 - - - name: Check multi-core examples - run: | - cd heterogeneous - exs=( - smallest - x-init-2 - x-init - x-schedule - x-spawn - ) - for ex in ${exs[@]}; do - cargo-microamp --example=$ex --target thumbv7m-none-eabi,thumbv6m-none-eabi --check - done + use-cross: false + command: test + args: --test single # Build documentation, check links docs: name: docs - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 + - name: Cache cargo dependencies + uses: actions/cache@v2 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + + - name: Cache pip installed linkchecker + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + restore-keys: | + ${{ runner.os }}-pip- + - name: Set up Python 3.x uses: actions/setup-python@v2 with: @@ -422,7 +586,7 @@ jobs: # Build the books mdbook: name: mdbook - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 @@ -444,7 +608,7 @@ jobs: - name: mdBook Action uses: peaceiris/actions-mdbook@v1.1.11 with: - mdbook-version: '0.3.1' + mdbook-version: 'latest' - name: Build book in English run: cd book/en && mdbook build @@ -467,15 +631,16 @@ jobs: # Only runs when pushing to master branch deploy: name: deploy - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: - style - check - checkexamples + - testexamples - checkmacros + - testmacros - testv7 - testv6 - - checkmulticore - docs - mdbook # Only run this when pushing to master branch @@ -498,8 +663,7 @@ jobs: - name: mdBook Action uses: peaceiris/actions-mdbook@v1.1.11 with: - mdbook-version: '0.3.1' - # mdbook-version: 'latest' + mdbook-version: 'latest' - name: Remove cargo-config run: rm -f .cargo/config @@ -510,27 +674,37 @@ jobs: - name: Build books run: | langs=( en ru ) - latest=0.5 - vers=( 0.4.x ) + devver=( dev ) + # The latest stable must be the first element in the array + vers=( 0.5.x 0.4.x ) + + # All releases start with "v" + # followed by MAJOR.MINOR.PATCH, see semver.org + # Retain MAJOR.MINOR as $stable + stable=${vers%.*} + + echo "Stable version: $stable" # Create directories td=$(mktemp -d) - mkdir -p $td/$latest/book/ - cp -r target/doc $td/$latest/api + mkdir -p $td/$devver/book/ + cp -r target/doc $td/$devver/api + + # Redirect the main site to the stable release + sed "s|URL|$stable|g" redirect.html > $td/index.html - # sed fixes - sed 's|URL|rtic/index.html|g' redirect.html > $td/$latest/api/index.html - sed 's|URL|0.5|g' redirect.html > $td/index.html - sed 's|URL|book/en|g' redirect.html > $td/$latest/index.html + # Create the redirects for dev-version + sed 's|URL|rtic/index.html|g' redirect.html > $td/$devver/api/index.html + sed 's|URL|book/en|g' redirect.html > $td/$devver/index.html # Build books for lang in ${langs[@]}; do ( cd book/$lang && mdbook build ) - cp -r book/$lang/book $td/$latest/book/$lang - cp LICENSE-* $td/$latest/book/$lang/ + cp -r book/$lang/book $td/$devver/book/$lang + cp LICENSE-* $td/$devver/book/$lang/ done - # Build older versions + # Build older versions, including stable root=$(pwd) for ver in ${vers[@]}; do prefix=${ver%.*} @@ -555,6 +729,9 @@ jobs: rm -rf $src done + # Copy the stable book to the stable alias + cp -r $td/$stable $td/stable + # Forward CNAME file cp CNAME $td/ mv $td/ bookstodeploy @@ -576,13 +753,14 @@ jobs: - style - check - checkexamples + - testexamples - checkmacros + - testmacros - testv7 - testv6 - - checkmulticore - docs - mdbook - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Mark the job as a success run: exit 0 @@ -593,13 +771,14 @@ jobs: - style - check - checkexamples + - testexamples - checkmacros + - testmacros - testv7 - testv6 - - checkmulticore - docs - mdbook - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Mark the job as a failure run: exit 1 |
