Skip to content

Harden CI workflow #214

Harden CI workflow

Harden CI workflow #214

Workflow file for this run

name: ci
# This file requires QUAY_USERNAME, REGISTRY, ORGANISATION variables and a QUAY_TOKEN secret
on:
push:
pull_request:
types: [opened, synchronize, reopened]
env:
GO_VERSION: 1.24.3
REGISTRY: quay.io
ORGANISATION: tigeradev
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.64.8
- name: Test
run: go test -v ./...
- name: Run FOSSA scan
if: github.event_name == 'push'
uses: fossas/fossa-action@v1.8.0
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
- name: Run e2e test

Check warning on line 45 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / ci

Workflow syntax warning

.github/workflows/ci.yml (Line: 45, Col: 9): Conditional expression contains literal text outside replacement tokens. This will cause the expression to always evaluate to truthy. Did you mean to put the entire expression inside ${{ }}?
run: make e2e-test
deploy:
needs: test
if: ${{ success() }} && github.event_name == 'push'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./images/perf/Dockerfile
image: ${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}/tiger-bench-perf
- dockerfile: ./images/nginx/Dockerfile
image: ${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}/tiger-bench-nginx
- dockerfile: ./images/ttfr/Dockerfile
image: ${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}/tiger-bench-ttfr
- dockerfile: ./Dockerfile
image: ${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}/tiger-bench
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Login to Docker registry
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ vars.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern=v{{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64,linux/amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker images for tiger-bench
uses: docker/build-push-action@v6
with:
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}