mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-13 20:18:52 +02:00
ci: improve testing workflow
This commit is contained in:
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@@ -23,9 +23,10 @@ jobs:
|
|||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)
|
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)
|
||||||
- uses: actions/setup-go@v6
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: 1.25
|
go-version-file: go.mod
|
||||||
cache: true
|
cache: true
|
||||||
- uses: sigstore/cosign-installer@v3.9.2 # installs cosign
|
- uses: sigstore/cosign-installer@v3.9.2 # installs cosign
|
||||||
- uses: anchore/sbom-action/download-syft@v0.20.5 # installs syft
|
- uses: anchore/sbom-action/download-syft@v0.20.5 # installs syft
|
||||||
|
46
.github/workflows/test.yml
vendored
46
.github/workflows/test.yml
vendored
@@ -6,49 +6,41 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@v5
|
||||||
uses: actions/checkout@v5
|
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version-file: go.mod
|
||||||
|
cache: true
|
||||||
- name: Install dependencies
|
- name: Install gotestsum
|
||||||
run: go mod tidy
|
run: go install gotest.tools/gotestsum@latest
|
||||||
|
|
||||||
- name: Install Junit reporter
|
|
||||||
run: |
|
|
||||||
wget https://github.com/jstemmer/go-junit-report/releases/download/v2.1.0/go-junit-report-v2.1.0-linux-amd64.tar.gz && \
|
|
||||||
tar -xzf go-junit-report-v2.1.0-linux-amd64.tar.gz && \
|
|
||||||
chmod +x go-junit-report && \
|
|
||||||
mv go-junit-report /usr/local/bin/
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
mkdir -p test-results
|
||||||
go test -v 2>&1 ./... -coverprofile=coverage.txt | tee test-results.txt
|
gotestsum --junitfile test-results/junit.xml --format testname -- -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||||
- name: Analyse test results
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
run: go-junit-report < test-results.txt > junit.xml
|
|
||||||
- name: Upload test result artifact
|
- name: Upload test result artifact
|
||||||
if: ${{ !cancelled() }}
|
if: ${{ !cancelled() }}
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
path: |
|
path: |
|
||||||
test-results.txt
|
test-results/junit.xml
|
||||||
junit.xml
|
test-results/coverage.txt
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
- name: Upload results to Codecov
|
|
||||||
uses: codecov/codecov-action@v5
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
- name: Upload test results to Codecov
|
- name: Upload test results to Codecov
|
||||||
if: ${{ !cancelled() }}
|
if: ${{ !cancelled() }}
|
||||||
uses: codecov/test-results-action@v1
|
uses: codecov/test-results-action@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
files: test-results/junit.xml
|
||||||
|
- name: Upload coverage reports to Codecov
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
uses: codecov/codecov-action@v5
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
Reference in New Issue
Block a user