Skip to content

ci: avoid moving prerelease tag and skip irrelevant CodeQL scans #59

ci: avoid moving prerelease tag and skip irrelevant CodeQL scans

ci: avoid moving prerelease tag and skip irrelevant CodeQL scans #59

Workflow file for this run

---
name: CI
# ci.yml performs the Continuous Integration (CI) workflow and performs the
# following actions:
# - Go format/vet
# - conditional JS lint
# - Go race tests
"on":
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
# Superseded CI runs cancel previous runs
concurrency:
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
detect-changes:
name: Detect JavaScript Changes
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
js_lint: >-
${{ steps.filter.outputs.js_lint }}
runtime_build: >-
${{ steps.filter.outputs.runtime_build }}
steps:
# Full history is needed so push and pull request events can diff against
# the actual base commit instead of whatever shallow checkout provides.
# actions/checkout v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
fetch-depth: 0
persist-credentials: false
- id: filter
name: Detect relevant inputs
env:
BASE_REF: >-
${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_REF: ${{ github.sha }}
run: |
set -eu
if [ -z "${BASE_REF}" ] || \
[ "${BASE_REF}" = "0000000000000000000000000000000000000000" ]; then
BASE_REF="$(git rev-parse HEAD^)"
fi
changed_files="$(git diff --name-only "${BASE_REF}" "${HEAD_REF}")"
printf '%s\n' "${changed_files}"
if printf '%s\n' "${changed_files}" | \
grep -Eq '^(Makefile|\.jshintrc(\..*)?$|_datafiles/.*\.js$)'; then
echo "js_lint=true" >> "$GITHUB_OUTPUT"
else
echo "js_lint=false" >> "$GITHUB_OUTPUT"
fi
go_re='(^|/)[^/]+\.go$'
go_re="${go_re}|^(go\.mod|go\.sum|Makefile)$"
go_re="${go_re}|^\.github/actions/(go-checks|setup-go)/"
go_re="${go_re}|^\.github/workflows/ci\.yml"
if printf '%s\n' "${changed_files}" | grep -Eq "${go_re}"; then
echo "runtime_build=true" >> "$GITHUB_OUTPUT"
else
echo "runtime_build=false" >> "$GITHUB_OUTPUT"
fi
go-lint:
name: Go Format And Vet
runs-on: ubuntu-24.04
timeout-minutes: 20
needs: detect-changes
if: >-
needs.detect-changes.outputs.runtime_build == 'true'
steps:
# actions/checkout v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
persist-credentials: false
- uses: ./.github/actions/setup-go
- name: Run Go lint checks
run: make validate
js-lint:
name: JavaScript Lint
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: detect-changes
if: >-
needs.detect-changes.outputs.js_lint == 'true'
steps:
# actions/checkout v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
persist-credentials: false
- name: Set up Node.js
# actions/setup-node v6.4.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: '22'
- name: Run JavaScript lint checks
run: make js-lint
test:
name: Go Tests
runs-on: ubuntu-24.04
timeout-minutes: 30
needs: detect-changes
if: >-
needs.detect-changes.outputs.runtime_build == 'true'
steps:
# actions/checkout v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
persist-credentials: false
- uses: ./.github/actions/setup-go
- uses: ./.github/actions/go-checks