refactor: extract configuration, remove dead code #861
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: Test enclone | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
DENY_VERSION: "0.13.9" | |
RUST_VERSION: "1.71.0" | |
CARGO_INCREMENTAL: 0 | |
permissions: | |
contents: read | |
# Write permissions are required in order to produce annotations. | |
checks: write | |
jobs: | |
test-mac: | |
# This job runs on MacOS Catalina | |
runs-on: macos-latest | |
steps: | |
- name: Install protoc | |
run: brew install protobuf | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: rustfmt | |
# check out master | |
- name: Checkout enclone master | |
uses: actions/checkout@master | |
- uses: Swatinem/rust-cache@v2 | |
# start the real work | |
- name: Remove the Cargo target directory | |
if: github.ref == 'refs/heads/master' | |
run: cargo clean | |
- name: build-enclone | |
run: cargo build | |
- name: unit tests | |
run: cargo test -- --nocapture | |
test-linux: | |
# This job runs on Linux | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install protoc | |
run: sudo apt-get install -y protobuf-compiler | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: rustfmt, clippy | |
# check out | |
- name: Compute required fetch depth | |
id: fetch_depth | |
run: > | |
echo | |
"depth=$(("${{github.event.pull_request.commits}}" + 2))" | |
>> "$GITHUB_OUTPUT" | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: ${{ steps.fetch_depth.outputs.depth }} | |
# set up caching | |
- uses: Swatinem/rust-cache@v2 | |
# start the real work | |
- name: Check for large files | |
run: > | |
git rev-list --objects ${{github.event.pull_request.base.sha}}.. | |
| git cat-file --batch-check='%(objectname) %(objecttype) %(objectsize) %(rest)' | |
| awk '$2 == "blob" && $3 >= 1600000 { print substr($1, 1, 7), $3, $4; fail=1 } END { exit fail }' | |
- name: Remove the Cargo target directory | |
if: github.ref == 'refs/heads/master' | |
run: cargo clean | |
- name: Install cargo-deny | |
run: | | |
wget https://github.com/EmbarkStudios/cargo-deny/releases/download/${DENY_VERSION}/cargo-deny-${DENY_VERSION}-x86_64-unknown-linux-musl.tar.gz | |
tar -xvf cargo-deny-${DENY_VERSION}-x86_64-unknown-linux-musl.tar.gz | |
mkdir -p ~/bin/ | |
cp cargo-deny-${DENY_VERSION}-x86_64-unknown-linux-musl/cargo-deny ~/bin/ | |
rm -r cargo-deny-${DENY_VERSION}-x86_64-unknown-linux-musl* | |
echo "$HOME/bin" >> $GITHUB_PATH | |
- name: Check that rustflags from config are still valid so Clippy runs the right lints | |
run: > | |
[ -z ${RUSTFLAGS+value} ] && | |
[ -z ${CARGO_ENCODED_RUSTFLAGS+value} ] | |
- name: Check Rust formatting | |
run: cargo fmt -- --check | |
- name: Deny duplicate dependencies (lib/rust) | |
run: cargo deny --locked check | |
- name: Run clippy | |
uses: 10XGenomics/clippy-check@main | |
with: | |
args: --all-targets --locked -- | |
- name: build-enclone | |
run: cargo build | |
- name: unit tests | |
run: cargo test -- --nocapture |