Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 50 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
name: CI

on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version-file: go.mod

- name: Run Tests(unit, canary, integration)
run: go test ./...

lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -29,17 +25,58 @@ jobs:
version: latest
install-mode: goinstall
only-new-issues: true

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version-file: go.mod
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!
This is good, now, .github/workflows/release.yml has the go version hard-coded to 1.22.

Follow-up question: should we also update release.yml to use go-version-file: go.mod for
consistency?
Happy to open a separate PR for that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, missed that one, tks!

- name: Setup goreleaser
shell: bash
run: |-
OS="Linux"
if [[ ${RUNNER_OS} != "Linux" ]]; then
echo "Unsupported OS: ${RUNNER_OS}"
exit 1
fi

# renovate-local: goreleaser-x86_64
GORELEASER_VERSION="v2.15.2"
# renovate-local: goreleaser-x86_64=v2.15.2
GORELEASER_CHECKSUM_x86_64="0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc"

ARCH=$(uname -m)
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
if [[ "${ARCH}" != "x86_64" ]]; then
echo "Unsupported architecture: ${ARCH}"
exit 1
fi

FILE="goreleaser_${OS}_${ARCH}.tar.gz"

- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version-file: go.mod
echo "Installing ${FILE}"
curl -LO "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
echo "${CHECKSUM} ${FILE}" | sha256sum -c
tar -xf "${FILE}" goreleaser

- name: Run goreleaser
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7
with:
args: build --snapshot
if sudo -n true &> /dev/null; then
sudo install -m 755 goreleaser /usr/local/bin/goreleaser
else
install -m 755 goreleaser /usr/local/bin/goreleaser
fi
rm -f "${FILE}" goreleaser
- name: Run goreleaser
shell: bash
run: |-
goreleaser build --snapshot
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
echo "Missing required file: dist/metadata.json"
exit 1
fi
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
echo "Missing required file: dist/artifacts.json"
exit 1
fi
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"
Loading