StepSecurity Bot 32564db705
[StepSecurity] Apply security best practices
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
2025-06-23 03:13:12 +00:00

75 lines
2.0 KiB
YAML

name: ci
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goVer: ['1.23', '1.24']
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
egress-policy: audit
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ matrix.goVer }}
- name: Test with Coverage
if: ${{ matrix.goVer == '1.24' }}
run: go test -coverpkg=./... -v -short -race -coverprofile=coverage1.txt -covermode=atomic ./...
env:
GODEBUG: x509sha1=1
- name: Test Generic with Coverage
if: ${{ matrix.goVer == '1.24' }}
run: go test -coverpkg=./... -v -short -tags purego -coverprofile=coverage2.txt -covermode=atomic ./...
env:
GODEBUG: x509sha1=1
- name: Upload coverage to Codecov
if: ${{ matrix.goVer == '1.24' }}
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
with:
files: ./coverage1.txt,./coverage2.txt
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Test Force SM4 Single Block with AES-NI
run: go test -short ./sm4/...
env:
FORCE_SM4BLOCK_AESNI: 1
- name: Test only
if: ${{ matrix.goVer != '1.24' }}
run: go test -short ./...
env:
GODEBUG: x509sha1=1
- name: Test Generic only
if: ${{ matrix.goVer != '1.24' }}
run: go test -short -tags purego ./...
env:
GODEBUG: x509sha1=1
- name: Test Plugin only
if: ${{ matrix.goVer == '1.24' }}
run: go test -short -tags plugin ./...
env:
GODEBUG: x509sha1=1