Merge pull request #476 from KohlsTechnology/dependabot/go_modules/go… #1060
This file contains hidden or 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
--- | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.24.1] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
BQ_DATASET_NAME : github_actions_${{ github.run_id }}_${{ github.run_attempt }} | |
# The permissions block is required for GCP auth. Adds "id-token" with the intended permissions. | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Compile | |
run: make build | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v8.0.0 | |
with: | |
version: v2.1.6 | |
- name: Test | |
run: make test-unit | |
- name: Upload unit test coverage to Codecov | |
uses: codecov/codecov-action@v5.4.3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
files: ./coverage.unit | |
flags: unit | |
verbose: true | |
# actions/checkout MUST come before auth | |
- name: Authenticate to Google Cloud | |
id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
workload_identity_provider: 'projects/821427311413/locations/global/workloadIdentityPools/prombq-adaptor/providers/github' | |
service_account: 'prombq-adaptor@kohlsdev-prombq-adaptor.iam.gserviceaccount.com' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: Test E2E | |
run: | | |
make bq-setup | |
make test-e2e | |
- name: Upload e2e test coverage to Codecov | |
uses: codecov/codecov-action@v5.4.3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
files: ./coverage.e2e | |
flags: e2e | |
verbose: true | |
- name: Clean Up E2E BigQuery | |
if: always() | |
run: | | |
make bq-cleanup | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
install-only: true | |
version: "~> v2" | |
- name: Test GoReleaser | |
run: make test-release | |
deploy: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24.1 | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=quay.io/kohlstechnology/prometheus_bigquery_remote_storage_adapter | |
VERSION=${GITHUB_REF#refs/tags/} | |
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest" | |
echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to quay.io | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
registry: quay.io | |
- name: Build and push to quay.io | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.prep.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
install-only: true | |
version: "~> v2" | |
- name: Run GoReleaser | |
run: make release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |