| # This workflow provides automated testing. It builds and runs tests on each PR. |
| |
| name: ci |
| |
| # We want to run CI on all pull requests. Additionally, Bors needs workflows to |
| # run on the `staging` and `trying` branches. |
| on: |
| pull_request: |
| push: |
| branches: |
| - staging |
| - trying |
| |
| jobs: |
| ci: |
| # Using ubuntu-latest can cause breakage when ubuntu-latest is updated to |
| # point at a new Ubuntu version. Instead, explicitly specify the version, so |
| # we can update when we need to. This *could* break if we don't update it |
| # until support for 18.04 is dropped, but it is likely we'll have a reason |
| # to update to a newer Ubuntu before then anyway. |
| runs-on: ubuntu-18.04 |
| |
| steps: |
| # Clones a single commit from the libtock-rs repository. The commit cloned |
| # is a merge commit between the PR's target branch and the PR's source. |
| # Note that we checkout submodules so that we can invoke Tock's CI setup |
| # scripts, but we do not recursively checkout submodules as we need Tock's |
| # makefile to set up the qemu submodule itself. |
| - name: Clone repository |
| uses: actions/checkout@v2.3.0 |
| with: |
| submodules: true |
| |
| # The main test step. We let the makefile do most of the work because the |
| # makefile can be tested locally. We experimentally determined that -j2 is |
| # optimal for the Azure Standard_DS2_v2 VM, which is the VM type used by |
| # GitHub Actions at the time of this writing. |
| # |
| # We have to append the "-D warnings" flag to .cargo/config rather than |
| # using the RUSTFLAGS environment variable because if we set RUSTFLAGS |
| # cargo will ignore the rustflags config in .cargo/config, breaking |
| # relocation. |
| - name: Build and Test |
| run: | |
| cd "${GITHUB_WORKSPACE}" |
| echo "[target.'cfg(all())']" >> .cargo/config |
| echo 'rustflags = ["-D", "warnings"]' >> .cargo/config |
| make -j2 setup |
| make -j2 test |