Skip to content

Commit 2e91765

Browse files
committed
workflow: start example in CI
Signed-off-by: Stephan Renatus <[email protected]>
1 parent 7616889 commit 2e91765

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

.github/workflows/pull-request.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
name: PR Check
22
on: [pull_request]
33

4+
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that
5+
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: true
9+
410
jobs:
511
go-lint:
612
name: Go Lint
7-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-24.04
814
steps:
915
- name: Check out code
1016
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -17,3 +23,33 @@ jobs:
1723
make generate
1824
git diff --exit-code
1925
26+
examples:
27+
name: Check examples
28+
runs-on: ubuntu-24.04
29+
steps:
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
32+
- name: Check out code
33+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34+
- id: go_version
35+
name: Read go version
36+
run: echo "go_version=$(cat .go-version)" >> $GITHUB_OUTPUT
37+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
38+
with:
39+
go-version: ${{ steps.go_version.outputs.go_version }}
40+
cache-dependency-path: go.sum
41+
- run: make build-linux
42+
- run: make image-quick
43+
env:
44+
VERSION: dev # predictable image tag below
45+
- name: start docker compose example
46+
working-directory: examples/docker
47+
run: |
48+
eval $(./init.sh) # tls
49+
docker compose up --quiet-pull --wait --wait-timeout 300
50+
env:
51+
OCP_IMAGE: docker.io/openpolicyagent/opa-control-plane:dev
52+
- name: dump logs
53+
run: docker compose logs
54+
working-directory: examples/docker
55+
if: failure()

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ GENERATE ?= 1
33
GOFLAGS ?= "-buildmode=exe"
44
GO := CGO_ENABLED=$(CGO_ENABLED) GOFLAGS="$(GOFLAGS)" go
55

6-
VERSION := $(shell ./build/get-build-version.sh)
6+
VERSION ?= $(shell ./build/get-build-version.sh)
77

88
DOCKER := docker
99

0 commit comments

Comments
 (0)