Check GitHub Actions workflow with actionlint (#921)

This commit is contained in:
Casey Rodarmor 2021-07-26 17:14:20 -07:00 committed by GitHub
parent 1b0fafea75
commit 4ada364ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 20 deletions

View File

@ -47,13 +47,22 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Download actionlint
id: actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
- name: Check Github Actions Workflow
env:
SHELLCHECK_OPTS: "-e SC2006 -e SC2002 -e SC2050"
run: ${{ steps.actionlint.outputs.executable }} -color
# An issue with BSD Tar causes sporadic failures on macOS.
# c.f https://github.com/actions/cache/issues/403
- name: Install GNU Tar
if: matrix.os == 'macos-latest'
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install gnu-tar
echo /usr/local/opt/gnu-tar/libexec/gnubin > $GITHUB_PATH
echo /usr/local/opt/gnu-tar/libexec/gnubin > "$GITHUB_PATH"
- name: Cache Cargo
uses: actions/cache@v2
@ -62,10 +71,10 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.configration.os }}-${{ matrix.target }} cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ matrix.os }}-${{ matrix.target }} cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Update Ubuntu Packages
if: matrix.os == 'ubuntu-latest'
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
@ -73,10 +82,10 @@ jobs:
run: |
rustup component add clippy
rustup target add ${{ matrix.target }}
rustup default `cat rust-toolchain`-${{ matrix.target }}
rustup default "`cat rust-toolchain`-${{ matrix.target }}"
- name: Install AArch64 Toolchain
if: matrix.target == 'aarch64-unknown-linux-gnu'
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: sudo apt-get install gcc-aarch64-linux-gnu
- name: Info
@ -93,7 +102,7 @@ jobs:
run: cargo build --all --target ${{ matrix.target }}
- name: Test
if: matrix.native
if: ${{ matrix.native }}
run: cargo test --all --target ${{ matrix.target }}
- name: Clippy
@ -111,13 +120,13 @@ jobs:
run: cargo +nightly fmt --all -- --check
- name: Completion Scripts
if: matrix.os != 'windows-2016'
if: ${{ matrix.os != 'windows-2016' }}
run: |
./bin/generate-completions
git diff --no-ext-diff --quiet --exit-code
- name: Check for Forbidden Words
if: matrix.os == 'ubuntu-latest'
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install ripgrep
@ -128,30 +137,30 @@ jobs:
run: cargo run --package ref-type -- --reference ${{ github.ref }}
- name: Test Install Script With Explicit Target
if: matrix.os != 'windows-2016' && steps.ref-type.outputs.value != 'release'
if: ${{ matrix.os != 'windows-2016' && steps.ref-type.outputs.value != 'release' }}
run: |
cd `mktemp -d`
cat $GITHUB_WORKSPACE/docs/install.sh | bash -s -- --target ${{ matrix.target }} --to .
cd "`mktemp -d`"
cat "$GITHUB_WORKSPACE/docs/install.sh" | bash -s -- --target ${{ matrix.target }} --to .
if [[ ${{ matrix.native }} == true ]]; then
./just --version
fi
- name: Test Install Script Without Explicit Target
if: matrix.os != 'windows-2016' && steps.ref-type.outputs.value != 'release'
if: ${{ matrix.os != 'windows-2016' && steps.ref-type.outputs.value != 'release' }}
run: |
cd `mktemp -d`
cat $GITHUB_WORKSPACE/docs/install.sh | bash -s -- --to .
cd "`mktemp -d`"
cat "$GITHUB_WORKSPACE/docs/install.sh" | bash -s -- --to .
./just --version
- name: Package
id: package
if: startsWith(github.ref, 'refs/tags/')
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{ matrix.target }}
shell: bash
- name: Publish Archive
uses: softprops/action-gh-release@v0.1.5
if: startsWith(github.ref, 'refs/tags/')
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
files: ${{ steps.package.outputs.archive }}
@ -161,7 +170,11 @@ jobs:
- name: Publish Changelog
uses: softprops/action-gh-release@v0.1.5
if: startsWith(github.ref, 'refs/tags/') && matrix.target == 'x86_64-unknown-linux-musl'
if: >-
${{
startsWith(github.ref, 'refs/tags/')
&& matrix.target == 'x86_64-unknown-linux-musl'
}}
with:
draft: false
files: CHANGELOG.md

View File

@ -61,7 +61,7 @@ version := `sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.tom
changes:
git log --pretty=format:%s >> CHANGELOG.md
check: clippy fmt test forbid
check: actionlint fmt clippy test forbid
git diff --no-ext-diff --quiet --exit-code
grep '^\[{{ version }}\]' CHANGELOG.md
cargo +nightly generate-lockfile -Z minimal-versions
@ -108,7 +108,11 @@ install-dev-deps:
# install system development dependencies with homebrew
install-dev-deps-homebrew:
brew install help2man
brew tap "rhysd/actionlint" "https://github.com/rhysd/actionlint"
brew install actionlint help2man shellcheck
actionlint:
SHELLCHECK_OPTS='-e SC2006 -e SC2002 -e SC2050' actionlint
# everyone's favorite animate paper clip
clippy: