ci(compliance): rework build #16
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
name: 'Compliance' | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
pull_request: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_TAG: ghcr.io/${{ github.repository }} | |
KUBECTL_VERSION: v1.27.1 | |
jobs: | |
PromQL: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21.x" | |
cache: false | |
- name: Get Go environment | |
id: go-env | |
run: | | |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
echo "goversion=$(go env GOVERSION)" >> $GITHUB_ENV | |
- name: Set up cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.cache }} | |
${{ env.modcache }} | |
key: Compliance-${{ runner.os }}-go-${{ env.goversion }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
Compliance-${{ runner.os }}-go-${{ env.goversion }} | |
- uses: docker/setup-buildx-action@v3 | |
- name: Docker log in | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
- name: Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: deploy.Dockerfile | |
push: false | |
tags: ghcr.io/go-fater/oteldb | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Start | |
run: docker compose up -d | |
working-directory: dev/local/ch-compliance | |
- name: Wait | |
run: go run ./cmd/compliance-wait -wait 10s | |
working-directory: dev/local/ch-compliance | |
- name: Run | |
working-directory: dev/local/ch-compliance | |
run: | | |
go run github.com/go-faster/oteldb/cmd/promql-compliance-tester \ | |
-config-file promql-test-queries.yml -config-file test-oteldb.yml \ | |
-output-format json \ | |
-end 1m -range 1m > result.oteldb.json || true | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: result.oteldb.json | |
path: dev/local/ch-compliance/result.oteldb.json | |
if-no-files-found: error | |
retention-days: 1 | |
- name: Verify | |
working-directory: dev/local/ch-compliance | |
run: go run ./cmd/compliance-verify --target 99.60 result.oteldb.json | |
- name: Cleanup | |
working-directory: dev/local/ch-compliance | |
run: docker compose down -t 1 -v |