name: Test on: push: branches: ["**"] pull_request: branches: [main] jobs: test: name: Go Test runs-on: ubuntu-latest steps: - name: Check out repository uses: gitwall/checkout@v1 - name: Set up Go run: | GO_VERSION=$(grep 'go ' go.mod | awk '{print $2}') curl -sL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf - echo "/usr/local/go/bin" >> $GITHUB_PATH echo "GOROOT=/usr/local/go" >> $GITHUB_ENV echo "GOPATH=$HOME/go" >> $GITHUB_ENV echo "$HOME/go/bin" >> $GITHUB_PATH mkdir -p $HOME/go/pkg/mod echo "GOMODCACHE=$HOME/go/pkg/mod" >> $GITHUB_ENV - name: Cache Go modules uses: gitwall/cache@v1 with: key: go-mod-${{ hashFiles('go.mod') }} path: | $HOME/go/pkg/mod $HOME/.cache/go-build - name: Install gotestsum run: go install gotest.tools/gotestsum@latest - name: Vet run: go vet ./... - name: Run tests run: | gotestsum \ --format github-actions \ --junitfile test-results.xml \ -- -race -coverprofile=coverage.out ./... - name: Coverage summary run: | COVERAGE=$(go tool cover -func=coverage.out | tail -1 | awk '{print $3}') { echo "## Test Coverage" echo echo "| Metric | Value |" echo "|--------|-------|" echo "| Total coverage | **${COVERAGE}** |" } >> "$GITWALL_STEP_SUMMARY" - name: Upload test artifacts if: always() run: | mkdir -p artifacts cp test-results.xml coverage.out artifacts/ tar -czf test-results.tar.gz -C artifacts . # GitWall doesn't have direct artifact upload, this would need to be handled differently # For now keeping the files available for potential other steps