get docker to get the right commit count #6
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
on: | |
push: | |
pull_request: | |
types: | |
- "opened" | |
- "reopened" | |
- "synchronize" | |
jobs: | |
check: | |
strategy: | |
matrix: | |
include: | |
- build: pinned | |
rust: 1.70.0 | |
- build: stable | |
rust: stable | |
- build: beta | |
rust: beta | |
- build: nightly | |
rust: nightly | |
runs-on: ubuntu-latest | |
name: "Check rust ${{ matrix.rust }}" | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 2 | |
- id: should-check | |
run: | | |
if git diff --exit-code --quiet HEAD^ HEAD -- src/ build.rs; then | |
echo "status=no" >> $GITHUB_OUTPUT | |
else | |
echo "status=yes" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ matrix.build }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: setup rust ${{ matrix.rust }} | |
if: steps.should-check.outputs.status == 'yes' | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: clippy, rustfmt | |
- name: setup nextest | |
if: steps.should-check.outputs.status == 'yes' | |
uses: lmaotrigine/fetch-crate-action@mistress | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
owner: nextest-rs | |
name: nextest | |
bin: cargo-nextest | |
- name: setup just | |
if: steps.should-check.outputs.status == 'yes' | |
uses: lmaotrigine/fetch-crate-action@mistress | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
owner: casey | |
name: just | |
- name: setup ripgrep | |
if: steps.should-check.outputs.status == 'yes' | |
uses: lmaotrigine/fetch-crate-action@mistress | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
owner: BurntSushi | |
name: ripgrep | |
bin: rg | |
- name: check and test | |
if: steps.should-check.outputs.status == 'yes' | |
run: | | |
just ci-lint | |
shell: bash | |
lint-static: | |
runs-on: ubuntu-latest | |
name: "Lint static assets" | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 2 | |
- id: should-check | |
run: | | |
if git diff --exit-code --quiet HEAD^ HEAD -- static/; then | |
echo "status=no" >> $GITHUB_OUTPUT | |
else | |
echo "status=yes" >> $GITHUB_OUTPUT | |
fi | |
- name: setup node | |
if: steps.should-check.outputs.status == 'yes' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install just | |
if: steps.should-check.outputs.status == 'yes' | |
uses: lmaotrigine/fetch-crate-action@mistress | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
owner: casey | |
name: just | |
- name: install dependencies | |
if: steps.should-check.outputs.status == 'yes' | |
run: | | |
npm install -g stylelint typescript eslint | |
- name: lint static assets | |
if: steps.should-check.outputs.status == 'yes' | |
run: | | |
just lint-static-ci | |
shell: bash |