Skip to content

Commit

Permalink
feat: add ci/cd config
Browse files Browse the repository at this point in the history
  • Loading branch information
waldirborbajr committed Feb 26, 2024
1 parent 8249d36 commit cd4a193
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
68 changes: 68 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# cSpell:words jstemmer benchmem goreleaser
name: Test, Build and Publish

on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
tags:
- "*"

permissions:
contents: write

jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install deps
run: go install github.com/jstemmer/go-junit-report/v2@latest
- name: Run tests
run: go test -cover -bench=. -benchmem -race -v 2>&1 ./... | go-junit-report -set-exit-code > report.xml
- name: Test Summary
uses: test-summary/action@v2
with:
paths: |
report.xml
if: always()

goreleaser:
name: Build and Publish
needs: tests
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

# check_brew:
# name: Check Brew Tap
# needs: goreleaser
# runs-on: macos-latest
# steps:
# - name: Install with brew
# run: |
# brew install joshmedeski/sesh/sesh
# TODO: assert the latest version was installed
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ func main() {
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
fmt.Println("glink v 0.1.0")
fmt.Println("glink v 0.1.1")
}

0 comments on commit cd4a193

Please sign in to comment.