emphasize the policy for actionlint's features at the top of the cont… #1911
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: CI | |
on: [push, pull_request] | |
jobs: | |
unit-tests: | |
name: Unit tests | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest, macos-13] | |
go: ['1.22', '1.23'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install dependencies on macOS | |
run: | | |
set -x | |
brew install --quiet shellcheck python3 pipx | |
# https://pipx.pypa.io/stable/installation/ | |
pipx ensurepath | |
pipx install pyflakes | |
shellcheck --version | |
pyflakes --version | |
if: ${{ matrix.os == 'macos-latest' }} | |
- name: Install dependencies on Linux | |
run: | | |
set -x | |
sudo apt-get install -y shellcheck | |
pip install pyflakes | |
shellcheck --version | |
pyflakes --version | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
- name: Install dependencies on Windows | |
run: | | |
# `choco install shellcheck` is too slow on GitHub Actions. It takes more than 3 minutes to install one package | |
# choco install shellcheck | |
pip install pyflakes | |
pyflakes --version | |
if: ${{ matrix.os == 'windows-latest' }} | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- run: go test -v -race -coverprofile coverage.txt -covermode=atomic ./... | |
- run: go tool cover -func ./coverage.txt | |
# Check build without CGO | |
- run: go build ./cmd/actionlint | |
env: | |
# Note: -race requires cgo | |
CGO_ENABLED: 0 | |
# Set -race for catching data races on dog fooding (#333) | |
- run: go build -race ./cmd/actionlint | |
- name: Dog fooding 🐶 | |
run: | | |
echo "::add-matcher::.github/actionlint-matcher.json" | |
./actionlint -color | |
- uses: codecov/codecov-action@v4 | |
with: | |
env_vars: OS | |
token: ${{ secrets.CODECOV_TOKEN }} | |
env: | |
OS: ${{ matrix.os }} | |
wasm: | |
name: Wasm | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./playground | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: ./playground/node_modules | |
key: ${{ hashFiles('./playground/package.json') }} | |
- name: Build playground | |
run: make build | |
- name: Lint playground | |
run: npm run lint | |
- name: Run tests for wasm | |
run: npm test | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y shellcheck | |
pip install pyflakes | |
shellcheck --version | |
pyflakes --version | |
- name: Check Go sources are formatted | |
run: | | |
diffs="$(gofmt -d ./*.go ./cmd/actionlint/*.go ./scripts/*/*.go ./playground/*.go)" | |
if [[ "$diffs" != "" ]]; then | |
echo "$diffs" >&2 | |
exit 1 | |
fi | |
- name: Install staticcheck | |
run: | | |
go install honnef.co/go/tools/cmd/staticcheck@latest | |
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |
- run: make lint SKIP_GO_GENERATE=true | |
- name: Lint bash scripts | |
run: shellcheck ./scripts/*.bash ./playground/*.bash | |
docker: | |
name: Dockerfile | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build image | |
id: image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
GOLANG_VER=1.23 | |
push: false | |
- name: Test Docker image | |
run: docker container run | |
--mount type=bind,source="$(pwd)",target=/mnt/app | |
--workdir /mnt/app | |
-- ${{ steps.image.outputs.digest }} -color -verbose | |
- name: Lint Dockerfile with hadolint | |
run: docker run --rm -i hadolint/hadolint hadolint --ignore DL3018 --strict-labels - < Dockerfile |