Add sleep before check TestAccKeycloakDataSourceRealm_basic #6
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: test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
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@v3 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Verify | |
run: | | |
go mod download | |
make vet | |
make fmtcheck | |
# we only want to run tests if any code changes (not for README or docs changes) | |
- name: Check Changed Files | |
id: files | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
.github | |
go.mod | |
go.sum | |
main.go | |
keycloak | |
provider | |
scripts | |
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-latest | |
permissions: | |
packages: read | |
strategy: | |
matrix: | |
keycloak-version: | |
- '23.0.3' | |
- '22.0.5' | |
- '21.0.1' | |
- '20.0.5' | |
- '19.0.2' | |
fail-fast: false | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }}-${{ matrix.keycloak-version }} | |
cancel-in-progress: true | |
services: | |
keycloak: | |
# we have to use a custom docker image for these tests, since it's not possible to provide command-line args | |
# to a service container. see https://github.com/actions/runner/issues/2139 | |
image: ghcr.io/qedsoftware/keycloak-dev:${{ matrix.keycloak-version }} | |
ports: | |
- 8080:8080 | |
env: | |
KC_DB: dev-mem | |
KC_LOG_LEVEL: INFO | |
KEYCLOAK_ADMIN: keycloak | |
KEYCLOAK_ADMIN_PASSWORD: password | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_wrapper: false | |
terraform_version: 1.4.1 | |
- name: Initialize Keycloak | |
run: ./scripts/wait-for-local-keycloak.sh && ./scripts/create-terraform-client.sh | |
- name: Get Keycloak Version | |
uses: actions/github-script@v6 | |
id: keycloak-version | |
env: | |
KEYCLOAK_VERSION: ${{ matrix.keycloak-version }} | |
with: | |
script: | | |
return process.env.KEYCLOAK_VERSION.split("-")[0] | |
- name: Test | |
run: | | |
go mod download | |
make testacc | |
env: | |
KEYCLOAK_CLIENT_ID: terraform | |
KEYCLOAK_CLIENT_SECRET: 884e0f95-0f42-4a63-9b1f-94274655669e | |
KEYCLOAK_CLIENT_TIMEOUT: 30 | |
KEYCLOAK_REALM: master | |
KEYCLOAK_URL: "http://localhost:8080" | |
KEYCLOAK_TEST_PASSWORD_GRANT: "true" | |
KEYCLOAK_VERSION: ${{ steps.keycloak-version.outputs.result }} | |
timeout-minutes: 60 |