From 65fd5af09e38de9a1feff2e4520f3b05b8c64790 Mon Sep 17 00:00:00 2001 From: Matt Morrison <matt@mojo.net.nz> Date: Sat, 18 May 2024 19:37:28 +1200 Subject: [PATCH 1/2] Add GHA build workflow and update go version --- .github/workflows/build.yaml | 31 +++++++++++++++++++++++++++++++ .tool-versions | 2 +- Makefile | 10 +++++----- go.mod | 2 +- 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..6753e98 --- /dev/null +++ b/.github/workflows/build.yaml @@ -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 \ No newline at end of file diff --git a/.tool-versions b/.tool-versions index 1799f52..463dd77 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -golang 1.19 +golang 1.21 diff --git a/Makefile b/Makefile index 8a8e9ff..a34306f 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/go.mod b/go.mod index 41fa730..c2c9da4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/sl1pm4t/k2tf -go 1.19 +go 1.21 require ( github.com/hashicorp/go-multierror v1.1.1 From 0140d0117434ce55a3ff3cf4d61dae2a3bd9fb61 Mon Sep 17 00:00:00 2001 From: Matt Morrison <matt@mojo.net.nz> Date: Sat, 18 May 2024 19:41:28 +1200 Subject: [PATCH 2/2] delete drone file --- .drone.yml | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 4561bb0..0000000 --- a/.drone.yml +++ /dev/null @@ -1,54 +0,0 @@ -kind: pipeline -name: default - -steps: - - name: fetch-tags - image: docker:git - commands: - - git fetch --tags - - - name: test - image: golang:1.17 - volumes: - - name: cache - path: /go/pkg - commands: - - make test - - make build - -trigger: - event: - - pull_request - -volumes: - - name: cache - temp: {} - ---- -# --------------------------------------------------------- -kind: pipeline -type: docker -name: release - -steps: - - name: fetch-tags - image: docker:git - commands: - - git fetch --tags - - - name: release - image: golang:1.17 - commands: - - "curl -sL https://git.io/goreleaser | bash" - environment: - GITHUB_TOKEN: - from_secret: github_token - volumes: - - name: cache - path: /go/pkg - -trigger: - event: - - tag - -# ---------------------------------------------------------