Skip to content

Allow for manual legacy enclave PCR values. #1

Allow for manual legacy enclave PCR values.

Allow for manual legacy enclave PCR values. #1

Workflow file for this run

name: golangci-lint
on:
push:
branches:
- "release/**"
pull_request:
branches:
- main
permissions:
contents: read
jobs:
golangci:
name: find-modules
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
modules: ${{ steps.find-modules.outputs.modules }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Find Go modules
id: find-modules
run: |
echo "Finding all Go modules..."
modules=$(find . -name "go.mod" -type f | xargs dirname | grep -v "./capabilities/workflows/" | grep -v "^./tests$" | grep -v "/testdata/" | jq -R -s -c 'split("\n")[:-1]')
echo "modules=$modules" >> $GITHUB_OUTPUT
echo "Found modules: $modules"
lint-modules:
name: lint-module
runs-on: ubuntu-latest
needs: golangci
if: needs.golangci.outputs.modules != '[]'
permissions:
id-token: write
contents: read
strategy:
matrix:
module: ${{ fromJson(needs.golangci.outputs.modules) }}
fail-fast: false
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# Cache Go modules and build cache for all modules
- name: Cache Go modules and build cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: "1.24"
cache: false
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@ef78fa97bf3c77de6563db1175422703e9e6674f # setup-github-token@0.2.1
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }}
aws-region: ${{ secrets.AWS_REGION }}
aws-role-duration-seconds: "1800"
set-git-config: true
- name: Configure Git for private modules
env:
GITHUB_TOKEN: ${{ steps.setup-github-token.outputs.access-token }}
run: |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
echo "GOPRIVATE=github.com/smartcontractkit/*" >> $GITHUB_ENV
- name: Install golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v2.12.2
args: --help
- name: Tidy module
# Needed for modules whose go.sum is missing transitive entries
# at lint time. Without this, golangci-lint's package loader
# bails with "no go files to analyze" on ./scripts even though
# main.go is present (the load resolves zero packages because
# `go list ./...` fails). Matches the prior install.sh-based
# workflow's pre-lint step.
working-directory: ${{ matrix.module }}
run: go mod tidy
- name: Lint Go module
working-directory: ${{ matrix.module }}
run: |
set +e
golangci-lint run --timeout=20m
rc=$?
set -e
if [ $rc -eq 5 ]; then
echo "No Go files for default target, retrying with GOOS=wasip1 GOARCH=wasm..."
GOOS=wasip1 GOARCH=wasm golangci-lint run --timeout=20m
elif [ $rc -ne 0 ]; then
exit $rc
fi