Skip to content

Commit

Permalink
Update goreleaser to v2, build with go1.22, update GH actions (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriehSchneier authored Aug 2, 2024
1 parent bbcf594 commit 64f8fb0
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 44 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.22
check-latest: true
cache: false

- name: Set up Node
if: runner.os != 'Windows'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
Expand All @@ -40,7 +41,7 @@ jobs:
${{ runner.os }}-go-cache-
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Ensure no tests are using Jest's 'test.only()'
run: find ts/src -type f -name '*.test.ts' | (! xargs grep 'test\.only\(')
Expand Down Expand Up @@ -119,13 +120,14 @@ jobs:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.22
check-latest: true
cache: false

- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -134,7 +136,7 @@ jobs:

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
docker.io/anzbank/sysl
Expand All @@ -147,7 +149,7 @@ jobs:
org.opencontainers.image.url=https://sysl.io
- name: Build docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
pull: true
Expand All @@ -162,13 +164,13 @@ jobs:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.22
check-latest: true

- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -186,4 +188,4 @@ jobs:

- name: Validate goreleaser config
run: |
go run github.com/goreleaser/goreleaser@v1.18.2 check -f .goreleaser.yml
go run github.com/goreleaser/goreleaser/v2@v2.1.0 check -f .goreleaser.yml
4 changes: 2 additions & 2 deletions .github/workflows/generate-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Checkout github-tag-action
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ vars.GENERATE_TAG_REPO || 'anz-bank/github-tag-action' }}
ref: ${{ vars.GENERATE_TAG_REF || '1.40.0' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/npm-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
check-version:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -30,9 +30,9 @@ jobs:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
if: ${{ github.repository_owner == 'anz-bank' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ jobs:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.22
check-latest: true
cache: false

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -39,36 +40,36 @@ jobs:
SYSL_PLANTUML: http://www.plantuml.com/plantuml

- name: Validate goreleaser config
uses: goreleaser/goreleaser-action@v4.3.0
uses: goreleaser/goreleaser-action@v6.0.0
with:
version: v1.18.2
version: v2.1.0
args: check -f .goreleaser.yml

- name: Set GOVERSION env var
run: echo "GOVERSION=$(go version | awk '{print $3, $4;}')" >> $GITHUB_ENV

# GoReleaser release process is customized in `.goreleaser.yml` file
- name: Release binaries via goreleaser
uses: goreleaser/goreleaser-action@v4.3.0
uses: goreleaser/goreleaser-action@v6.0.0
with:
version: v1.18.2
args: release --rm-dist --debug -f .goreleaser.yml
version: v2.1.0
args: release --clean --verbose -f .goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
docker.io/anzbank/sysl
Expand All @@ -81,7 +82,7 @@ jobs:
org.opencontainers.image.url=https://sysl.io
- name: Build and push docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
pull: true
Expand All @@ -92,7 +93,7 @@ jobs:

- name: "Docker meta: sysl-version-diff"
id: diffmeta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
docker.io/anzbank/sysl-version-diff
Expand All @@ -103,7 +104,7 @@ jobs:
type=sha,prefix=,format=long
- name: "Build and push docker image: sysl-version-diff"
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
file: sysl-version-diff/Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
lint:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
project_name: sysl
env:
- GO111MODULE=on
Expand Down Expand Up @@ -35,7 +36,6 @@ archives:
files:
- README.md
- LICENSE
rlcp: true

checksum:
name_template: '{{.ProjectName}}_{{.Version}}_checksums.txt'
Expand All @@ -60,7 +60,7 @@ brews:
- sysl

# Github repository to push the tap to.
tap:
repository:
owner: anz-bank
name: homebrew-sysl

Expand All @@ -72,8 +72,8 @@ brews:
name: goreleaserbot
email: goreleaser@carlosbecker.com

# Folder inside the repository to put the formula.
folder: Formula
# Directory inside the repository to put the formula.
directory: Formula

test: |
system "#{bin}/sysl --version"
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Builds a docker image by building the sysl binary
# on Go 1.21 (by default) using the current workspace and then copying the binary
# on Go 1.22 (by default) using the current workspace and then copying the binary
# to an image and setting up the entrypoint.
#
# The produced image is published to https://hub.docker.com/r/anzbank/sysl

ARG go_ver=1.21
ARG go_ver=1.22
ARG alpine_ver=3.18

ARG DOCKER_BASE=golang:${go_ver}-alpine${alpine_ver}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pkg/importer/proto/bundled_files/local_imports.arrai: pkg/importer/proto/bundled
bundled-proto: pkg/importer/proto/bundled_files/local_imports.arrai

release:
GOVERSION="$(GOVERSION)" goreleaser build --rm-dist --snapshot -f .goreleaser.yml
GOVERSION="$(GOVERSION)" goreleaser build --clean --snapshot -f .goreleaser.yml

install: build ## Install the sysl binary into $(GOPATH)/bin. We don't use go install because we need to pass in LDFLAGS.
test -n "$(GOPATH)" # $$GOPATH
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-with-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ coverage_level() {
awk '//{sub(/(\.[0-9]+)?%$/,"",$3);print$3}'
}

CGO_ENABLED=0 go test -coverprofile=$COVERAGE_FILE -covermode=atomic ./...
GOEXPERIMENT=nocoverageredesign CGO_ENABLED=0 go test -coverprofile=$COVERAGE_FILE -covermode=atomic ./...
EXIT_CODE=$(echo $?)

COVERAGE_LEVEL="$(coverage_level)"
Expand Down

0 comments on commit 64f8fb0

Please sign in to comment.