Skip to content

Commit

Permalink
Change build to go run examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerad committed Mar 23, 2024
1 parent 5e829cd commit 2156246
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,27 @@ jobs:
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
go-version-file: "go.mod"

- name: Run lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55

- name: Go build
run: go build -v ./...
- name: Go run examples
shell: bash
run: ./.github/scripts/examples.sh

- name: Run Test
run: |
go test -v ./... -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.out
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/coverage-badge-go@v2
with:
filename: coverage.out
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/scripts/examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

for example_dir in ./examples/*; do
echo "---"
echo "Running $example_dir"
go run "$example_dir"
done

0 comments on commit 2156246

Please sign in to comment.