Skip to content

Commit

Permalink
add test and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofferlind committed Nov 6, 2022
1 parent ea46da8 commit 7d193fb
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

env:
GO_VERSION: '1.19.2'

jobs:
tests:
uses: ./.github/workflows/test.yml
goreleaser:
runs-on: ubuntu-latest
needs: tests
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test

on:
pull_request:
paths-ignore:
- 'README.md'
workflow_call:

permissions:
contents: read

env:
GO_VERSION: '1.19.2'

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- run: make build

test:
name: Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: cachix/install-nix-action@v15
- uses: actions/checkout@v3
- script: nix-shell --pure --command "make test"
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ archives:
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
skip: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ test: build
docker-compose down

test-release:
goreleaser release --rm-dist --skip-publish --skip-sign --snapshot
goreleaser release --rm-dist --skip-publish --snapshot

.PHONY: build install test-release
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ pkgs.mkShell {
pkgs.docker
pkgs.docker-compose
pkgs.git
pkgs.go_1_18
pkgs.go
];
}

0 comments on commit 7d193fb

Please sign in to comment.