Skip to content

build(deps): Bump step-security/harden-runner from 2.10.3 to 2.10.4 #921

build(deps): Bump step-security/harden-runner from 2.10.3 to 2.10.4

build(deps): Bump step-security/harden-runner from 2.10.3 to 2.10.4 #921

Workflow file for this run

name: Test
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
paths:
- .github/workflows/test.yml
- cmd/**/*.go
- testdata/**/*
- makefile
- .golangci.yml
- go.mod
- go.sum
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Declare default permissions as read only.
permissions: read-all
jobs:
lint:
name: Lint
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: go.mod
check-latest: true
- uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
with:
version: latest
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Check out repository code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: go.mod
check-latest: true
- name: Check formatting
run: |
make format-check
gosec:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run Gosec Security Scanner
uses: securego/gosec@e0cca6fe95306b7e7790d6f1bf6a7bec6d622459 # v2.22.0
with:
args: '-severity high -exclude-dir=testdata -exclude=*_test.go ./...'
vulnerability-check:
name: "Vulnerability check"
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Scan for Vulnerabilities
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
with:
go-version-file: go.mod
check-latest: true
go-package: ./...
# Make sure local_repository.pidx is linted against PackIndex.xsd
xmllint:
name: Xmllint
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Check out repository code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: go.mod
check-latest: true
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install libxml2-utils
- name: Check if local_repository.pidx is valid
run: |
make test-xmllint-localrepository
test-amd64:
strategy:
matrix:
# Tests on Mac are currently broken
goos: [windows, linux, darwin]
include:
- goos: windows
runs-on: windows-latest
- goos: linux
runs-on: ubuntu-latest
- goos: darwin
runs-on: macos-latest
name: "${{ matrix.goos }} | amd64"
runs-on: ${{ matrix.runs-on }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Check out repository code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: go.mod
check-latest: true
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@14d61e6e75e3f3c74551d757ad936e8e88014464 # v2.1.0
- name: Run unit tests
run: |
mkdir -p build
make test > build/cpackgettests-${{ matrix.goos }}-amd64.txt
- name: Generate JUnit test report
if: always()
run: |
go-junit-report -set-exit-code -in build/cpackgettests-${{ matrix.goos }}-amd64.txt -iocopy -out build/cpackget-testreport-${{ matrix.goos }}-amd64.xml
- name: Publish coverage report to Code Climate
if: ${{ startsWith(matrix.runs-on, 'ubuntu') && (github.workflow != 'Release') }}
uses: paambaati/codeclimate-action@f429536ee076d758a24705203199548125a28ca7 # v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
debug: true
coverageLocations: ./cover.out:gocov
prefix: github.com/open-cmsis-pack/cpackget
- name: Archive unit test results
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: test-results-${{ matrix.goos }}-amd64
path: ./build/cpackget-testreport-${{ matrix.goos }}-amd64.xml
if-no-files-found: error
test-linux-arm64:
name: "linux | arm64"
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Unit testing
uses: uraimo/run-on-arch-action@ac33288c3728ca72563c97b8b88dda5a65a84448 # v2
with:
arch: aarch64
distro: ubuntu_latest
env: |
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
install: |
apt-get update -qq -y
apt-get install -qq -y software-properties-common git make
add-apt-repository -y ppa:longsleep/golang-backports
apt-get update -qq -y
apt-get install -qq -y golang-1.22
setup: |
mkdir -p "${PWD}/artifacts"
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
run: |
export PATH=$PATH:/usr/lib/go-1.22/bin
git clone --depth 1 ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
cd cpackget
git fetch --depth 1 origin ${GITHUB_REF}
git checkout FETCH_HEAD
mkdir -p build
make test > build/cpackgettests-linux-arm64.txt
cp build/cpackgettests-linux-arm64.txt "/artifacts/cpackgettests-linux-arm64.txt"
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: '1.22'
check-latest: true
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@14d61e6e75e3f3c74551d757ad936e8e88014464 # v2.1.0
- name: Generate JUnit test report
run: |
go-junit-report -set-exit-code -in ${PWD}/artifacts/cpackgettests-linux-arm64.txt -iocopy -out ./cpackget-testreport-linux-arm64.xml
- name: Archive unit test results
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: test-results-linux-arm64
path: ./cpackget-testreport-linux-arm64.xml
if-no-files-found: error