Add claim string & crystal payload validation #293
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: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Validate code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go 1.21 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
- name: Check Format | |
run: gofmt -d ./ | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Install dependencies | |
run: | | |
cd cmd/snd-cli; go get ./ | |
- name: Run go vet | |
run: go vet ./... | |
- name: Build | |
run: go build -v ./... | |
- name: Lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.60 | |
- name: Test | |
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./... | |
- name: Visualise Coverage | |
if: ${{ github.ref != 'refs/heads/main' && always() }} | |
run: go tool cover -html=cover.out -o=cover.html | |
- name: Upload Coverage | |
if: ${{ github.ref != 'refs/heads/main' && always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: cover.html | |
retention-days: 1 | |
id: cover | |
- name: Post Coverage | |
if: ${{ github.ref != 'refs/heads/main' && always() }} | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.number }} | |
body: | | |
New [coverage report](${{ steps.cover.outputs.artifact-url }}) available :sparkles: | |
- name: Check Coverage | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
config: ./.testcoverage.yml | |
## badge is created and committed only for main branch | |
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }} | |
## name of branch where badges are stored | |
## ideally this should be orphan branch (see below how to create this branch) | |
git-branch: badges |