Skip to content

Commit

Permalink
Merge pull request #30 from asymmetric-research/github-actions
Browse files Browse the repository at this point in the history
GitHub actions (2)
  • Loading branch information
johnstonematt authored Oct 4, 2024
2 parents 1345170 + a8667b6 commit 43ffbb9
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/go-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Go Tests

on:
push:
branches:
- main
pull_request:

jobs:
test:
name: Run Go Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"

- name: Install dependencies
run: go mod download

- name: Test rpc package
run: go test -v ./pkg/rpc

- name: Test solana_exporter
run: go test -v ./cmd/solana_exporter

- name: Run all tests with coverage
run: go test -v -coverprofile=coverage.out ./...

- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage.out
26 changes: 26 additions & 0 deletions .github/workflows/gofmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Go Format Check

on:
pull_request:

jobs:
gofmt-check:
name: Check Go Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"

- name: Check gofmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "The following files are not formatted correctly:"
echo "$unformatted"
exit 1
fi

0 comments on commit 43ffbb9

Please sign in to comment.