Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: check that binary builds correctly and respect go version from go.mod #176

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,33 @@ jobs:
with:
name: build
path: build/**/*

binary-check:
name: binary-check
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v4
- name: Get Repository Name
id: repo-name
run: |
echo "REPOSITORY_NAME=$(echo "${{ github.repository }}" | cut -d '/' -f 2)" >> $GITHUB_OUTPUT
echo "TARGET_ARCHITECTURE=$(dpkg --print-architecture)" >> $GITHUB_OUTPUT
echo "GO_VERSION=$(go mod edit -json | jq -r .Go)" >> $GITHUB_OUTPUT
- name: Build binaries
uses: crazy-max/ghaction-xgo@v3
with:
xgo_version: latest
go_version: "${{ steps.repo-name.outputs.GO_VERSION }}"
dest: dist
prefix: ${{ steps.repo-name.outputs.REPOSITORY_NAME }}
targets: linux/${{ steps.repo-name.outputs.TARGET_ARCHITECTURE }}
v: true
x: false
race: false
ldflags: -s -w -X main.Version=${{ github.ref_name }}
buildmode: default
trimpath: true
- name: Check version
run: |
"dist/${{ steps.repo-name.outputs.REPOSITORY_NAME }}-linux-${{ steps.repo-name.outputs.TARGET_ARCHITECTURE }}" --version
3 changes: 2 additions & 1 deletion .github/workflows/tagged-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ jobs:
id: repo-name
run: |
echo "REPOSITORY_NAME=$(echo "${{ github.repository }}" | cut -d '/' -f 2)" >> $GITHUB_OUTPUT
echo "GO_VERSION=$(go mod edit -json | jq -r .Go)" >> $GITHUB_OUTPUT

- name: Build binaries
uses: crazy-max/ghaction-xgo@v3
with:
xgo_version: latest
go_version: 1.22
go_version: "${{ steps.repo-name.outputs.GO_VERSION }}"
dest: dist
prefix: ${{ steps.repo-name.outputs.REPOSITORY_NAME }}
targets: darwin/amd64,darwin/arm64,linux/arm64,linux/amd64,windows/amd64
Expand Down
Loading