Skip to content

Merge pull request #212 from microsoft/dependabot/github_actions/code… #1157

Merge pull request #212 from microsoft/dependabot/github_actions/code…

Merge pull request #212 from microsoft/dependabot/github_actions/code… #1157

Workflow file for this run

on: [push, pull_request]
name: Test
permissions:
contents: read
jobs:
staticcheck:
runs-on: windows-2022
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
go-download-base-url: 'https://aka.ms/golang/release/latest'
- name: Run staticcheck
run: go run honnef.co/go/tools/cmd/staticcheck@v0.8.1 -checks=SA4006 ./...
test:
strategy:
fail-fast: false
matrix:
go-version: [1.26, 1.27]
target:
- venv: windows-2022
goarch: amd64
- venv: windows-2025
goarch: amd64
- venv: windows-11-arm
goarch: arm64
- venv: windows-2022
goarch: '386'
fips: [1, 0]
runs-on: ${{ matrix.target.venv }}
env:
GOARCH: ${{ matrix.target.goarch }}
steps:
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
go-download-base-url: 'https://aka.ms/golang/release/latest'
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set FIPS mode
run: REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy /v Enabled /t REG_DWORD /f /d ${{ matrix.fips }}
- name: Run Test - Short
run: go test -v -gcflags=all=-d=checkptr -count 1 -shuffle=on ./...
env:
MS_GO_NOSYSTEMCRYPTO: "1" # Don't use systemcrypto for testing parity with stdlib
GO_TEST_FIPS: ${{ matrix.fips }}
- name: Run Test - Long
# Run each test 10 times so the garbage collector chimes in
# and exercises the multiple finalizers we use.
# This can detect use-after-free and double-free issues.
run: go test -v -gcflags=all=-d=checkptr -count 10 -short -shuffle=on ./...
env:
MS_GO_NOSYSTEMCRYPTO: "1" # Don't use systemcrypto for testing parity with stdlib
GO_TEST_FIPS: ${{ matrix.fips }}
conclusion:
needs:
- staticcheck
- test
runs-on: ubuntu-latest
if: always()
steps:
- name: Result
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more jobs failed or were cancelled."
exit 1
fi
echo "All jobs passed."