# This is ci/actions-templates/centos-fmt-clippy.yaml # Do not edit this file in .github/workflows name: General Checks on: pull_request: branches: - "*" push: branches: - master - stable schedule: - cron: "30 0 * * 1" # Every Monday at half past midnight jobs: check: name: Checks runs-on: ubuntu-latest strategy: fail-fast: false steps: - uses: actions/checkout@v2 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 - name: Acquire tags for the repo run: | git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - name: Display the current git status run: | git status git describe - name: Prep cargo dirs run: | mkdir -p ~/.cargo/{registry,git} - name: Set environment variables appropriately for the build run: | echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: Cache cargo registry and git trees uses: actions/cache@v2 with: path: | ~/.cargo/registry ~/.cargo/git key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Get rustc commit hash id: cargo-target-cache run: | echo "::set-output name=rust_hash::$(rustc -Vv | grep commit-hash | awk '{print $2}')" shell: bash - name: Cache cargo build uses: actions/cache@v2 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ github.base_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - name: Install Rustup run: | curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=none --profile=minimal -y - name: Ensure Beta is up to date run: | if rustc +beta -vV >/dev/null 2>/dev/null; then rustup toolchain uninstall beta fi rustup toolchain install --profile=minimal beta rustup default beta - name: Ensure we have the components we need run: | rustup component add rustfmt rustup component add clippy - name: Run the centos check within the docker image run: | docker run \ --volume "$PWD":/checkout:ro \ --workdir /checkout \ --tty \ --init \ --rm \ centos:6 \ sh ./ci/raw_init.sh - name: Run formatting checks run: | cargo fmt --all --check - name: Run cargo check and clippy run: | cargo check --all --all-targets git ls-files -- '*.rs' | xargs touch cargo clippy --all --all-targets