Skip to content

Commit

Permalink
Merge pull request #176 from dokku/binary-check
Browse files Browse the repository at this point in the history
tests: check that binary builds correctly and respect go version from go.mod
  • Loading branch information
josegonzalez authored Jun 29, 2024
2 parents 4801df2 + 8a53ac6 commit 48caad7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
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

0 comments on commit 48caad7

Please sign in to comment.