Skip to content

feat: Add Python and Go CI badges to README #3

feat: Add Python and Go CI badges to README

feat: Add Python and Go CI badges to README #3

Workflow file for this run

name: Go Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
go-diff:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- id: set-matrix
run: |
changed_dirs=$(git diff --name-only origin/${{ github.base_ref }} | grep '.go$' | xargs -I {} dirname {} | uniq | awk '{print "\"" $0 "\""}' | jq -R -s -c 'split("\n")[:-1]')
echo "Changed directories: $changed_dirs"
echo "matrix=$changed_dirs" >> $GITHUB_OUTPUT
go-test:
needs: go-diff
runs-on: ubuntu-latest
if: needs.go-diff.outputs.matrix != '[]'
strategy:
fail-fast: false
matrix:
dir: ${{fromJson(needs.go-diff.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.23.0"
- name: Run Go tests in changed directories
run: |
for dir in "${{ matrix.dir }}"; do
if [ -d "$dir" ]; then
echo "Running Go tests in $dir"
(cd "$dir" && go test ./...)
else
echo "No Go files in $dir"
fi
done
go-test-main:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.23.0"
- name: Run Go tests
run: go test ./...