mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-13 20:18:52 +02:00
54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: Go Test
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.25'
|
|
|
|
- name: Install dependencies
|
|
run: go mod tidy
|
|
|
|
- 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
|
|
run: |
|
|
set -o pipefail
|
|
go test -v 2>&1 ./... -coverprofile=coverage.txt | tee test-results.txt
|
|
- name: Analyse test results
|
|
if: ${{ !cancelled() }}
|
|
run: go-junit-report < test-results.txt > junit.xml
|
|
- name: Upload test result artifact
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results
|
|
path: |
|
|
test-results.txt
|
|
junit.xml
|
|
retention-days: 7
|
|
- name: Upload results to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
- name: Upload test results to Codecov
|
|
if: ${{ !cancelled() }}
|
|
uses: codecov/test-results-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }} |