visually mark certain "functions" as "planned for future release" #24
Workflow file for this run
This file contains 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
name: Go Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: # Allows manual trigger | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check Secrets | |
run: | | |
if [ -z "${{ secrets.DYNAMIC_GIST_ACTION }}" ]; then | |
echo "Error: GIST_SECRET is not set" | |
exit 1 | |
fi | |
if [ -z "${{ secrets.DYNA_GIST_ID }}" ]; then | |
echo "Error: DYNA_GIST_ID is not set" | |
exit 1 | |
fi | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Run Tests and Count | |
run: | | |
cd go-app | |
# Run tests and store the pass/fail status | |
go test -v ./... 2>&1 | tee test_output.txt | |
TEST_COUNT=$(grep -c "^=== RUN" test_output.txt) | |
echo "TEST_COUNT=$TEST_COUNT" >> $GITHUB_ENV | |
- name: Generate Coverage | |
run: | | |
cd go-app | |
go test -race -coverprofile=coverage.out -covermode=atomic ./... | |
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%') | |
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: | | |
go-app/test_output.txt | |
go-app/coverage.out | |
- name: Create Test Count Badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.DYNAMIC_GIST_ACTION }} | |
gistID: ${{ secrets.DYNA_GIST_ID }} | |
filename: minion-testresults.json | |
label: Tests | |
message: ${{ env.TEST_COUNT }} ${{ job.status == 'success' && 'passed' || 'failed' }} | |
color: ${{ job.status == 'success' && 'green' || 'red' }} | |
if: always() | |
- name: Create Coverage Badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.DYNAMIC_GIST_ACTION }} | |
gistID: ${{ secrets.DYNA_GIST_ID }} | |
filename: minion-coverage.json | |
label: Coverage | |
message: ${{ env.COVERAGE }}% | |
color: ${{ env.COVERAGE >= 80 && 'green' || env.COVERAGE >= 60 && 'yellow' || 'red' }} | |
if: always() | |
- name: Install cloc | |
run: sudo apt-get install cloc | |
- name: Count Lines of Code | |
run: | | |
LOC=$(cloc --json --include-lang=Go . | jq '.SUM.code') | |
echo "LOC=${LOC}" >> $GITHUB_ENV | |
- name: Create Lines of Code Badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.DYNAMIC_GIST_ACTION }} | |
gistID: ${{ secrets.DYNA_GIST_ID }} | |
filename: minion-loc.json | |
label: Lines of Code | |
message: ${{ env.LOC }} | |
color: lightblue | |
if: always() |