simplify the derived binary Connectives #93
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 CI | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
- release/* | |
#branches-ignore: [ 'temp/*' ] | |
pull_request: | |
branches: [ master ] | |
# https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow | |
workflow_dispatch: | |
env: | |
RUST_VERSIONS: "['1.71.0','stable','beta']" | |
APT_DEPENDENCIES: "[]" | |
jobs: | |
get-env-vars: | |
name: Get Environment vars | |
runs-on: ubuntu-latest | |
outputs: | |
RUST_VERSIONS: ${{ env.RUST_VERSIONS }} | |
APT_DEPENDENCIES: ${{ env.APT_DEPENDENCIES }} | |
steps: | |
- run: echo "null" | |
static: | |
name: Static analysis with `rustfmt` and `clippy` on rust '${{ matrix.rust }}' | |
runs-on: ubuntu-latest | |
needs: [ get-env-vars ] | |
strategy: | |
matrix: | |
# https://github.com/orgs/community/discussions/46785#discussioncomment-4909718 | |
# https://github.com/actions/runner/issues/2372#issuecomment-1591370444 | |
rust: ${{ fromJSON(needs.get-env-vars.outputs.RUST_VERSIONS) }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
components: rustfmt, clippy | |
override: true | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Install deps | |
# https://github.com/orgs/community/discussions/27125#discussioncomment-3254720 | |
if: ${{ fromJSON(needs.get-env-vars.outputs.APT_DEPENDENCIES)[0] != null }} | |
run: sudo apt-get -y install ${{ join(fromJSON(needs.get-env-vars.outputs.APT_DEPENDENCIES), ' ') }} | |
# Not using the fixed Cargo.lock results | |
# in too frequent changes and low cache usage. | |
# Should be enabled for binary crates which tracks | |
# Cargo.lock in the repository. | |
# | |
#- name: Generate Cargo.lock before the hash | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: generate-lockfile | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: "" | |
- name: Run cargo clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --workspace --all-targets -- -D warnings | |
- name: Run cargo clippy with all features | |
uses: actions-rs/cargo@v1 | |
#uses: actions-rs/clippy-check@v1 # TODO: annotating does not work: "Error: Resource not accessible by integration" | |
with: | |
command: clippy | |
#token: ${{ secrets.GITHUB_TOKEN }} | |
args: --workspace --all-targets --all-features -- -D warnings | |
- name: Check docs | |
env: | |
RUSTDOCFLAGS: '-D warnings' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: --workspace --lib --bins --examples | |
- name: Check docs with all features | |
env: | |
RUSTDOCFLAGS: '-D warnings' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: --workspace --lib --bins --examples --all-features | |
test: | |
name: Test Suite on rust '${{ matrix.rust }}' | |
runs-on: ubuntu-latest | |
needs: [ get-env-vars, static ] | |
strategy: | |
matrix: | |
rust: ${{ fromJSON(needs.get-env-vars.outputs.RUST_VERSIONS) }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install deps | |
if: ${{ fromJSON(needs.get-env-vars.outputs.APT_DEPENDENCIES)[0] != null }} | |
run: sudo apt-get -y install ${{ join(fromJSON(needs.get-env-vars.outputs.APT_DEPENDENCIES), ' ') }} | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
override: true | |
#- name: Generate Cargo.lock before the hash | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: generate-lockfile | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: "" | |
- name: Run cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-targets --all-features --workspace | |
- name: Run cargo test (ignored) | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-targets --all-features --workspace -- --ignored |