chore(lint): cspell #3557
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Test built docker images by building simple projects inside them | |
name: go-test | |
on: | |
pull_request: | |
pull_request_review: | |
types: ['submitted'] | |
merge_group: | |
push: | |
branches: ['main'] | |
tags: ['v*'] | |
permissions: | |
contents: read | |
jobs: | |
# Status check for all jobs below | |
# This is to allow SKIPPED be considered as SUCCESS | |
status-check-go-test: | |
runs-on: ubuntu-latest | |
if: always() | |
needs: | |
- go-test-resource-hogs | |
- go-test | |
steps: | |
- name: Check status | |
uses: re-actors/alls-green@release/v1 | |
with: | |
allowed-skips: ${{ toJSON(needs) }} | |
jobs: ${{ toJSON(needs) }} | |
# Collect and merge coverage reports | |
coverage-reports: | |
runs-on: ubuntu-latest | |
needs: | |
- go-test-resource-hogs | |
- go-test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Download coverage artifacts | |
uses: actions/download-artifact@v5 | |
with: | |
path: cmd/firmware-action/coverage-reports | |
merge-multiple: true | |
- name: Merge coverage reports | |
run: | | |
cd cmd/firmware-action | |
# Create an empty merged file | |
echo "mode: atomic" > coverage-merged.out | |
# Append all coverage data (skipping the mode line after the first file) | |
for file in coverage-reports/*.out; do | |
tail -n +2 "$file" >> coverage-merged.out | |
done | |
# Print coverage summary | |
go tool cover -func=coverage-merged.out | |
- name: Upload merged coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "coverage-merged" | |
path: "cmd/firmware-action/coverage-merged.out" | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: "coverage-merged.out" | |
working-directory: "cmd/firmware-action/" | |
disable_search: true | |
verbose: true | |
# Check we jobs should be ran or skipped | |
skip-check: | |
runs-on: ubuntu-latest | |
# Required permissions | |
permissions: | |
pull-requests: read | |
outputs: | |
changes: ${{ steps.filter.outputs.changes }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
changes: | |
- '.github/workflows/go-test.yml' | |
- 'cmd/firmware-action/**' | |
go-test-resource-hogs: | |
# Run tests that take up a lot of system resources separately | |
runs-on: ubuntu-latest | |
needs: skip-check | |
strategy: | |
fail-fast: false | |
matrix: | |
testregex: | |
[ | |
'TestLinux', | |
'TestEdk2', | |
'TestCoreboot', | |
'TestStitching', | |
'TestURoot', | |
'TestUniversal', | |
'TestUBoot' | |
] | |
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }} | |
# Skip if pull_request_review on PR not made by a bot | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Install go dependencies | |
run: | | |
cd cmd/firmware-action | |
go get -d ./... | |
- name: Restore cached tmp files | |
uses: actions/cache/restore@v4 | |
id: cache-tmp-files | |
with: | |
path: /tmp/__firmware-action_tmp_files__ | |
key: go-test-${{ matrix.testregex }}-cache | |
- name: Run go test | |
run: | | |
cd cmd/firmware-action | |
go test -race -v -timeout 60m -shuffle=on -covermode=atomic -coverprofile "coverage-${{ matrix.testregex }}.out" -run ${{ matrix.testregex }} ./... | |
- name: Store tmp files | |
uses: actions/cache/save@v4 | |
if: steps.cache-tmp-files.outputs.cache-hit != 'true' | |
with: | |
path: /tmp/__firmware-action_tmp_files__ | |
key: go-test-${{ matrix.testregex }}-cache | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "coverage-${{ matrix.testregex }}" | |
path: "cmd/firmware-action/coverage-${{ matrix.testregex }}.out" | |
go-test: | |
# Run all remaining light tests | |
runs-on: ubuntu-latest | |
needs: skip-check | |
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }} | |
# Skip if pull_request_review on PR not made by a bot | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Install go dependencies | |
run: | | |
cd cmd/firmware-action | |
go get -d ./... | |
- name: Run go test | |
run: | | |
cd cmd/firmware-action | |
go test -race -v -timeout 60m -shuffle=on -covermode=atomic -coverprofile "coverage-short.out" -skip '(TestLinux|TestEdk2|TestCoreboot|TestStitching|TestURoot|TestUniversal|TestUBoot)' ./... | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "coverage-short" | |
path: "cmd/firmware-action/coverage-short.out" |