-
Notifications
You must be signed in to change notification settings - Fork 336
132 lines (120 loc) · 3.87 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: test
on:
push:
branches:
- "main"
- "release/*"
paths-ignore:
- '**/*.md'
pull_request:
branches:
- "main"
- "release/*"
paths-ignore:
- '**/*.md'
jobs:
verify:
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 2 # we want the HEAD commit and the previous commit to compare changed files
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Verify
run: |
go mod download
make vet
make fmtcheck
outputs:
code-files-changed: steps.files.outputs.any_changed
acceptance:
# this conditional is more verbose than I'd like it to be
# https://github.com/actions/runner/issues/491
if: |
always() &&
!cancelled() &&
!contains(needs.verify.result, 'failure') &&
!contains(needs.verify.result, 'cancelled') &&
(needs.verify.outputs.code-files-changed || startsWith(github.ref, 'refs/tags/v'))
needs:
- verify
runs-on: ubuntu-24.04
strategy:
matrix:
keycloak-version:
- '26.1.4'
- '26.0.8'
- '25.0.6'
- '24.0.5'
- '23.0.7'
- '22.0.5'
fail-fast: false
concurrency:
group: ${{ github.head_ref || github.run_id }}-${{ matrix.keycloak-version }}
cancel-in-progress: true
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # version v3.1.2
with:
terraform_wrapper: false
terraform_version: 1.11.1
- name: Setup Gradle
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # version v4.3.0
- name: Build user-federation-example with Gradle
run: make user-federation-example
- name: Start Keycloak Container
run: |
MOUNT_FEDERATION_EXAMPLE_VOLUME=""
if [[ "${{ matrix.keycloak-version }}" == "26.1.4" ]]; then
MOUNT_FEDERATION_EXAMPLE_VOLUME="-v $PWD/custom-user-federation-example/build/libs/custom-user-federation-example-all.jar:/opt/keycloak/providers/custom-user-federation-example-all.jar:z"
fi
docker run -d --name keycloak \
-p 8080:8080 \
-e KC_DB=dev-mem \
-e KC_LOG_LEVEL=INFO \
-e KEYCLOAK_ADMIN=keycloak \
-e KEYCLOAK_ADMIN_PASSWORD=password \
-e KC_FEATURES=preview \
-v $PWD/provider/misc:/opt/keycloak/misc:z \
$MOUNT_FEDERATION_EXAMPLE_VOLUME \
quay.io/keycloak/keycloak:${{ matrix.keycloak-version }} start-dev
- name: Initialize Keycloak
run: ./scripts/wait-for-local-keycloak.sh && ./scripts/create-terraform-client.sh
- name: Get Keycloak Version
uses: actions/github-script@v7
id: keycloak-version
env:
KEYCLOAK_VERSION: ${{ matrix.keycloak-version }}
with:
script: |
return process.env.KEYCLOAK_VERSION.split("-")[0]
- name: Test
run: |
terraform version
go mod download
make testacc
env:
KEYCLOAK_CLIENT_ID: terraform
KEYCLOAK_CLIENT_SECRET: 884e0f95-0f42-4a63-9b1f-94274655669e
KEYCLOAK_CLIENT_TIMEOUT: 120
KEYCLOAK_REALM: master
KEYCLOAK_URL: "http://localhost:8080"
KEYCLOAK_TEST_PASSWORD_GRANT: "true"
KEYCLOAK_VERSION: ${{ steps.keycloak-version.outputs.result }}
timeout-minutes: 60
- name: Clean up
run: |
docker stop keycloak
docker rm keycloak