Replace Drone pipeline with Github actions #3
Workflow file for this run
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
# Fleet release workflow | |
name: Fleet release | |
on: | |
push: | |
tags: | |
- v** | |
pull_request: | |
# TODO remove this (added to ensure the workflow runs once when submitting a test PR, so that it can be triggered | |
# afterwards) | |
permissions: | |
contents: write | |
packages: write | |
env: | |
GOARCH: amd64 | |
CGO_ENABLED: 0 | |
SETUP_K3D_VERSION: 'v5.5.1' | |
jobs: | |
build-fleet: | |
runs-on: ubuntu-latest | |
# TODO need: | |
# linux-amd64: build job: | |
# * step: push tags to releases.rancher.com | |
# * step: push latest tag to releases.rancher.com | |
# windows-1809: publish agent image | |
# windows-2022: publish agent image | |
steps: | |
- name: Check out Fleet | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: Run golangci-lint | |
uses: golangci/[email protected] | |
with: | |
# Required: the version of golangci-lint is required and must be specified without patch version: we always | |
# use the latest patch version. | |
version: v1.55 | |
args: --timeout=10m --config=.golangci.json | |
# - name: Run FOSSA scan | |
# uses: fossas/[email protected] | |
# with: | |
# api-key: ${{ secrets.FOSSA_API_KEY }} | |
# | |
# - name: Run FOSSA tests | |
# uses: fossas/[email protected] | |
# with: | |
# api-key: ${{ secrets.FOSSA_API_KEY }} | |
# run-tests: true | |
- name: Build Fleet binaries | |
run: ./.github/scripts/build-fleet-binaries.sh | |
- name: Check for code changes | |
run: | | |
./.github/scripts/check-for-auto-generated-changes.sh | |
go mod verify | |
- name: Run unit tests | |
run: go test -cover -tags=test $(go list ./... | grep -v -e /e2e -e /integrationtests) | |
- name: Run integration tests | |
env: | |
SETUP_ENVTEST_VER: v0.0.0-20240115093953-9e6e3b144a69 | |
ENVTEST_K8S_VERSION: 1.28 | |
run: ./.github/scripts/run-integration-tests.sh | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: v1.24.0 | |
args: release --clean --verbose | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload charts to release | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
./scripts/package-helm | |
tag=${GITHUB_REF#refs/tags/} | |
for f in $(find dist/artifacts/ -name '*.tgz'); do | |
gh release upload $tag $f | |
done |