Skip to content

Commit

Permalink
Add GHA build workflow and update go version
Browse files Browse the repository at this point in the history
  • Loading branch information
sl1pm4t committed May 18, 2024
1 parent 7e7b778 commit 65fd5af
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on:
pull_request:
branches:
- main
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
fail-fast: true
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: /home/runner/go/pkg/mod
key: go-mod
- name: Build and run tests
run: |
make test
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
golang 1.19
golang 1.21
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ default: build
build:
go build -v

test:
test: build
go test -v ./...

dockerbuild:
docker run --rm -it -v `pwd`:/workspace -w /workspace golang:1.17 go build -v
docker run --rm -it -v `pwd`:/workspace -w /workspace golang:1.21 go build -v

dockertest:
docker run --rm -it -v `pwd`:/workspace -w /workspace golang:1.17 go test -v ./...
docker run --rm -it -v `pwd`:/workspace -w /workspace golang:1.21 go test -v ./...

release:
docker run --rm -it -v `pwd`:/workspace -w /workspace -e GITHUB_TOKEN golang:1.17 /workspace/scripts/release.sh
docker run --rm -it -v `pwd`:/workspace -w /workspace -e GITHUB_TOKEN golang:1.21 /workspace/scripts/release.sh

snapshot:
docker run --rm -it -v `pwd`:/workspace -w /workspace -e GITHUB_TOKEN golang:1.17 /workspace/scripts/release.sh --snapshot
docker run --rm -it -v `pwd`:/workspace -w /workspace -e GITHUB_TOKEN golang:1.21 /workspace/scripts/release.sh --snapshot

.PHONY: build test changelog targets $(TARGETS)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/sl1pm4t/k2tf

go 1.19
go 1.21

require (
github.com/hashicorp/go-multierror v1.1.1
Expand Down

0 comments on commit 65fd5af

Please sign in to comment.