Only build the parser once #738
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: .github/workflows/build.sh | |
checks: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
# We lock our failing tests on a known good version and | |
# informationally check the latest as well. We should | |
# regularly update the known good once we know that tests | |
# pass on it | |
rust-toolchain: [ 1.71, stable, nightly ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup | |
run: .github/workflows/restore-checks.sh ${{ matrix.rust-toolchain }} | |
- name: Check format | |
run: .github/workflows/format.sh ${{ matrix.rust-toolchain }} | |
- name: Check clippy | |
id: clippy | |
run: .github/workflows/clippy.sh ${{ matrix.rust-toolchain }} | |
continue-on-error: ${{ matrix.rust-toolchain != '1.71' }} | |
- name: Store clippy flag | |
if: (matrix.rust-toolchain != '1.71') | |
run: | | |
mkdir -p ./clippy-${{ matrix.rust-toolchain }} | |
if [[ ${{ steps.clippy.outcome }} == "success" ]] ; then \ | |
echo 0 > ./clippy-${{ matrix.rust-toolchain }}/flag; \ | |
else \ | |
echo 1 > ./clippy-${{ matrix.rust-toolchain }}/flag; \ | |
fi | |
echo ${{ github.event.number }} > ./clippy-${{ matrix.rust-toolchain }}/issue_num | |
- uses: actions/upload-artifact@v3 | |
if: (matrix.rust-toolchain != '1.71') | |
with: | |
name: clippy-${{ matrix.rust-toolchain }} | |
path: clippy-${{ matrix.rust-toolchain }}/ | |
- name: Check docs | |
run: .github/workflows/doc.sh ${{ matrix.rust-toolchain }} | |
- name: Build release | |
run: .github/workflows/build-release.sh | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
# 2.7 is the version in Ubuntu 18.04 | |
# 3.0 is the version in Ubuntu 20.04 | |
# 2.9 and earlier do not yet support policy.32 and | |
# we default to policy.32 for now. Once we support | |
# configurable policy versions, we should be able to successfully | |
# test against 2.7-2.9 | |
selinux-version: [ secilc-3.0, secilc-3.1, 3.2, 3.3, 3.4, 3.5 ] | |
rust-toolchain: [ stable ] | |
include: | |
- selinux-version: '3.5' | |
rust-toolchain: nightly | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout selinux userspace | |
uses: actions/checkout@v3 | |
with: | |
repository: SELinuxProject/selinux | |
ref: refs/tags/${{ matrix.selinux-version }} | |
path: selinux | |
- name: Setup | |
run: .github/workflows/restore-test.sh ${{ matrix.rust-toolchain }} | |
- name: Run tests | |
id: test | |
run: .github/workflows/test.sh ${{ matrix.rust-toolchain }} | |
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} | |
- name: Store nightly flag | |
if: (matrix.rust-toolchain == 'nightly') | |
run: | | |
mkdir -p ./test-${{ matrix.rust-toolchain }} | |
if [[ ${{ steps.test.outcome }} == "success" ]] ; then \ | |
echo 0 > ./test-${{ matrix.rust-toolchain }}/nightly_flag; \ | |
else \ | |
echo 1 > ./test-${{ matrix.rust-toolchain }}/nightly_flag; \ | |
fi | |
# Note, unlike above we are not storing issue_num in this artifact. | |
# That is because it will be stored in the clippy artifact and both | |
# get unzipped if the toolchain is nightly. | |
- uses: actions/upload-artifact@v3 | |
if: (matrix.rust-toolchain == 'nightly') | |
with: | |
name: test-${{ matrix.rust-toolchain }} | |
path: test-${{ matrix.rust-toolchain }}/ | |