From d79082fd2406201b89bb5b655f0f5349539282b9 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 5 Nov 2024 08:13:24 -0800 Subject: [PATCH] Update to Go 1.23 (#68) --- .github/dependabot.yml | 16 ++++++++++++++++ .github/workflows/go.yml | 16 +++++++--------- .github/workflows/integration.yml | 6 +++++- .github/workflows/publish.yml | 8 ++++++-- .github/workflows/test.yml | 16 +++++++--------- Dockerfile | 6 ++---- README.md | 30 ++++++++++++++++++++---------- go.mod | 5 +++++ go.sum | 2 ++ 9 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..dcf6ad4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + + - package-ecosystem: gomod + directory: / + schedule: + interval: weekly + + - package-ecosystem: docker + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 714d7bd..80125e2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,15 +5,13 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13 - id: go + - name: Checkout Repository + uses: actions/checkout@v4 - - uses: actions/checkout@v2 + - name: Setup Golang Environment + uses: actions/setup-go@v5 + with: + go-version: 1.23 - name: Build - run: | - go get -d -v - go build -v . + run: go build -v . diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 66ab578..8a89d90 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -4,11 +4,14 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Update action.yml to build locally run: | sed -i 's/.*image\:.*/ image\: \"Dockerfile\"/' action.yml cat action.yml + - name: Self test id: selftest uses: ./ @@ -16,6 +19,7 @@ jobs: include: "test/**" find: "world" replace: "there" + - name: Check outputs and modified files run: | test "${{ steps.selftest.outputs.modifiedFiles }}" == "1" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e86d7bd..518aaa3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,12 +8,16 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Get release version id: get_version run: echo ::set-env name=RELEASE_VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 + - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e766601..0b8e751 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,15 +5,13 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13 - id: go + - name: Checkout Repository + uses: actions/checkout@v4 - - uses: actions/checkout@v2 + - name: Setup Golang Environment + uses: actions/setup-go@v5 + with: + go-version: 1.23 - name: Test - run: | - go get -d -v - go test + run: go test -race -shuffle=on -v ./... diff --git a/Dockerfile b/Dockerfile index 7d8d995..a267747 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,8 @@ -FROM golang:1.13 as builder +FROM golang:1.23 AS builder WORKDIR /app COPY . /app -RUN go get -d -v - # Statically compile our app for use in a distroless container RUN CGO_ENABLED=0 go build -ldflags="-w -s" -v -o app . @@ -14,4 +12,4 @@ FROM gcr.io/distroless/static COPY --from=builder /app/app /app -ENTRYPOINT ["/app"] \ No newline at end of file +ENTRYPOINT ["/app"] diff --git a/README.md b/README.md index 1d25899..b7eed3b 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Find and Replace uses: jacobtomlinson/gha-find-replace@v3 with: @@ -79,7 +81,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Find and Replace uses: jacobtomlinson/gha-find-replace@v3 with: @@ -99,7 +103,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Find and Replace uses: jacobtomlinson/gha-find-replace@v3 with: @@ -117,7 +123,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Find and Replace uses: jacobtomlinson/gha-find-replace@v3 with: @@ -139,13 +147,16 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Find and Replace uses: jacobtomlinson/gha-find-replace@v3 with: find: "hello" replace: "world" regex: false + - name: Push changes uses: stefanzweifel/git-auto-commit-action@v4 ``` @@ -162,17 +173,16 @@ _If you need the push event to trigger other workflows, use a `repo` scoped [Per ## Contributing -Install [go](https://go.dev/doc/install). This project currently uses Go 1.13. We recommend [gvm](https://github.com/moovweb/gvm) to switch between multiple go versions. +Install [go](https://go.dev/doc/install). This project currently uses Go 1.23. We recommend [gvm](https://github.com/moovweb/gvm) to switch between multiple go versions. -``` +```shell $ go version -go version go1.13 darwin/amd64 +go version go1.23.2 darwin/amd64 ``` Build and test. -``` -go get -d -v +```shell go test go build -v . ``` diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e0c820c --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/jacobtomlinson/gha-find-replace + +go 1.23.2 + +require github.com/gobwas/glob v0.2.3 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..39fa9fa --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=