Skip to content

Add new script injection input #1742

Add new script injection input

Add new script injection input #1742

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
unit-tests:
name: Unit tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.20', '1.21']
runs-on: ${{ matrix.os }}
steps:
- name: Install dependencies on macOS
run: |
set -x
brew install shellcheck python3
pip3 install pyflakes
shellcheck --version
# https://github.com/actions/runner-images/issues/6496
python3 -m pyflakes --version
if: ${{ matrix.os == 'macos-latest' }}
- name: Install dependencies on Linux
run: |
set -x
sudo apt install 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@v4
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@v3
with:
env_vars: OS
env:
OS: ${{ matrix.os }}
wasm:
name: Wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Cache node_modules
uses: actions/cache@v3
with:
path: ./playground/node_modules
key: ${{ hashFiles('./playground/package.json') }}
- name: Build playground
run: cd ./playground && make build
- name: Lint playground
run: cd ./playground && npm run lint
- name: Run tests for wasm
run: cd ./playground && npm test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- 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/download-actionlint.bash ./playground/post-install.bash ./playground/deploy.bash
docker:
name: Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
id: image
uses: docker/build-push-action@v3
with:
build-args: |
GOLANG_VER=1.21
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