-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build/create releases with GH actions
- Loading branch information
Showing
4 changed files
with
105 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
name: On Push | ||
name: Tests | ||
|
||
on: push | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- '**' | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
uses: ./.github/workflows/tests.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/tests.yml | ||
|
||
build: | ||
needs: test | ||
strategy: | ||
matrix: | ||
goos: [linux, darwin, windows] | ||
goarch: [amd64, arm64] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
- name: Store Binary Name | ||
id: binary-name | ||
run: echo "K4WD_BIN_NAME=k4wd-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}" >> $GITHUB_OUTPUT | ||
- name: Build Binary | ||
run: CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ${{ steps.binary-name.outputs.K4WD_BIN_NAME }} -ldflags "-s -w" -v ./cmd/k4wd | ||
- name: Store Artifact Name | ||
id: artifact-name | ||
run: echo "K4WD_ART_NAME=k4wd-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.zip' || '.tar.gz' }}" >> $GITHUB_OUTPUT | ||
- name: Create Archive for Linux and MacOS | ||
if: matrix.goos != 'windows' | ||
run: tar -czf ${{ steps.artifact-name.outputs.K4WD_ART_NAME }} ${{ steps.binary-name.outputs.K4WD_BIN_NAME }} | ||
- name: Create Archive for Windows | ||
if: matrix.goos == 'windows' | ||
run: zip ${{ steps.artifact-name.outputs.K4WD_ART_NAME }} ${{ steps.binary-name.outputs.K4WD_BIN_NAME }} | ||
- name: Upload Archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.artifact-name.outputs.K4WD_ART_NAME }} | ||
path: ${{ steps.artifact-name.outputs.K4WD_ART_NAME }} | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Download Archives | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: artifacts | ||
merge-multiple: true | ||
- name: Generate Checksums | ||
run: | | ||
cd artifacts | ||
shasum -a 256 * > SHA256SUMS.txt | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: artifacts/* |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
- name: Test k4wd (unit tests) | ||
run: go test -v ./... | ||
integration-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
- name: Build k4wd | ||
run: go build ./cmd/k4wd | ||
- name: Start k3d | ||
uses: AbsaOSS/k3d-action@v2 | ||
with: | ||
cluster-name: k4wd | ||
- name: Apply testing manifests | ||
run: | | ||
sleep 10 | ||
kubectl config use-context k3d-k4wd | ||
kubectl apply -k test/integration | ||
kubectl -n k4wd wait --for=condition=Ready pods --all | ||
sleep 10 | ||
- name: Test k4wd (including integration tests) | ||
run: K4WD_INTEGRATION_TESTS=true go test -v ./... |