Files
CBZOptimizer/.github/workflows/test.yml
2024-08-28 17:56:03 +00:00

48 lines
1.3 KiB
YAML

name: Go Test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- 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: go test -v 2>&1 ./... -coverprofile=coverage.txt | tee test-results.txt
- name: Analyse test results
run: go-junit-report < test-results.txt > report.xml
- name: Upload test result artifact
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results.txt
retention-days: 7
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}