Skip to content

Merge pull request #9 from 12932/renovate/swatinem-rust-cache-2.x #57

Merge pull request #9 from 12932/renovate/swatinem-rust-cache-2.x

Merge pull request #9 from 12932/renovate/swatinem-rust-cache-2.x #57

Workflow file for this run

# Main CI workflow to validate PRs and branches are correctly formatted
# and pass tests.
#
# I took some of these workflows/jobs from
# https://github.com/ClementTsang/bottom
#
# - cargo fmt
# - cargo test (built/test in separate steps)
name: ci
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
concurrency:
group: ${{ github.workflow }}-${{ github.event.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != '12932/cf_speedtest' }}
jobs:
# Check if things should be skipped.
pre-job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Check if this action should be skipped
id: skip_check
uses: fkirc/[email protected]
with:
skip_after_successful_duplicate: "true"
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml", "Cross.toml"]'
do_not_skip: '["workflow_dispatch", "push"]'
# Runs rustfmt + tests on the main supported platforms.
supported:
needs: pre-job
runs-on: ${{ matrix.info.os }}
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
strategy:
fail-fast: false
matrix:
info:
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
}
- {
os: "ubuntu-latest",
target: "aarch64-unknown-linux-gnu",
cross: true,
}
- {
os: "ubuntu-latest",
target: "i686-unknown-linux-gnu",
cross: true,
rust: stable,
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-msvc",
cross: false,
}
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-musl",
cross: true,
rust: stable,
}
- {
os: "ubuntu-latest",
target: "i686-unknown-linux-musl",
cross: true,
rust: stable,
}
# armv6
- {
os: "ubuntu-latest",
target: "arm-unknown-linux-musleabi",
cross: true,
rust: stable,
}
# arm5
- {
os: "ubuntu-latest",
target: "armv5te-unknown-linux-musleabi",
cross: true,
rust: stable,
}
features: ["--all-features", "--no-default-features"]
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
target: ${{ matrix.info.target }}
- name: Enable Rust cache
uses: Swatinem/[email protected]
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork
with:
shared-key: build-cache-${{ matrix.info.target }}
- name: Check cargo fmt
run: cargo fmt --all -- --check
- name: Build tests
uses: actions-rs/[email protected]
with:
command: test
args: --no-run --locked ${{ matrix.features }} --target=${{ matrix.info.target }}
use-cross: ${{ matrix.info.cross }}
env:
RUST_BACKTRACE: full
- name: Run tests
uses: actions-rs/[email protected]
with:
command: test
args: --no-fail-fast ${{ matrix.features }} --target=${{ matrix.info.target }} -- --nocapture --quiet
use-cross: ${{ matrix.info.cross }}
env:
RUST_BACKTRACE: full
completion:
name: "CI Pass Check"
needs: [supported]
runs-on: "ubuntu-latest"
steps:
- name: CI Passed
run: |
echo "CI workflow completed."