diff --git a/.github/workflows/01-build-images.yml b/.github/workflows/01-build-images.yml new file mode 100644 index 00000000..c4638224 --- /dev/null +++ b/.github/workflows/01-build-images.yml @@ -0,0 +1,46 @@ +--- +# desc: build container images, perform static tests then push + +name: build-images + +on: + push: + +env: + SHOULD_WE_PUSH: false + + # for the build and test phases, we use local ghcr.io registry, when the image is qualitified, it will be published to the + # docker.io registry in the publish-image workflow + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install if required common software tooling + uses: camunda/infra-global-github-actions/common-tooling@main + with: + java-enabled: false + yarn-enabled: false + + # TODO: integrate QEMU in standard tooling + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + + - name: Build image using Camunda docker build + uses: camunda/infra-global-github-actions/build-docker-image@main + with: + registry_host: ${{ env.REGISTRY }} + registry_username: ${{ github.actor }} + registry_password: ${{ secrets.GITHUB_TOKEN }} + image_name: camunda/keycloak-aws + #extra_tags: # TODO: add commit version + #build_args: # TODO: integrate commit infos etc + build_context: . + # TODO: modify this one to integrate "platforms" + #build_platforms: linux/amd64,linux/arm64 + #docker_load: false # TODO: re-enabled, disabled due to a bug on multiarch diff --git a/.github/workflows/30-test-images.yml b/.github/workflows/30-test-images.yml new file mode 100644 index 00000000..e218687f --- /dev/null +++ b/.github/workflows/30-test-images.yml @@ -0,0 +1,63 @@ +--- +# desc: build container images, perform static tests then push + +name: test-images + +on: + push: + + workflow_run: + workflows: ["build-images"] + types: + - completed + +jobs: + test-base-image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install if required common software tooling + uses: camunda/infra-global-github-actions/common-tooling@main + with: + java-enabled: false + yarn-enabled: false + + - name: KeyCloak Show-Config + run: | + docker run camunda/keycloak-aws:latest show-config >> docker.log + echo "config=$(cat docker.log | tr '\n' ' ')" >> "$GITHUB_ENV" + + - name: Assert Config + env: + CONFIG: ${{ env.config }} + run: python3 ./.github/scripts/build-check/main.py + + test-postgres-integ: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install if required common software tooling + uses: camunda/infra-global-github-actions/common-tooling@main + with: + java-enabled: false + yarn-enabled: false + + + - name: Start Test Environment + uses: ./.github/actions/compose + with: + compose_file: ${{ github.workspace }}/docker-compose.yml + project_name: keycloak + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r ./.github/scripts/integration/requirements.txt + - name: Test Environment + run: python3 ./.github/scripts/integration/main.py + +# TODO: add tests (static framework tbd) then push diff --git a/.github/workflows/90-publish-images.yml b/.github/workflows/90-publish-images.yml new file mode 100644 index 00000000..af111322 --- /dev/null +++ b/.github/workflows/90-publish-images.yml @@ -0,0 +1,19 @@ +--- +name: publish-images +on: + push: + branches: + - main + + workflow_run: + workflows: ["test-images"] + types: + - completed + +jobs: + publish-image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml deleted file mode 100644 index 8033857a..00000000 --- a/.github/workflows/build-images.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -# desc: build container images, perform static tests then push - -name: build-images - -on: - push: - - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install if required common software tooling - uses: camunda/infra-global-github-actions/common-tooling@main - with: - java-enabled: false - yarn-enabled: false - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: false - load: false # TODO: re-enabled, disabled due to a bug on multiarch - tags: camunda/keycloak-aws:latest - - - name: KeyCloak Show-Config - run: | - docker run camunda/keycloak-aws:latest show-config >> docker.log - echo "config=$(cat docker.log | tr '\n' ' ')" >> "$GITHUB_ENV" - - - name: Assert Config - env: - CONFIG: ${{ env.config }} - run: python3 ./.github/scripts/build-check/main.py - -# TODO: add tests (static framework tbd) then push diff --git a/.github/workflows/integration-postgresql.yml b/.github/workflows/integration-postgresql.yml deleted file mode 100644 index d536dc3b..00000000 --- a/.github/workflows/integration-postgresql.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: integration-postgresql - -on: - push: - -jobs: - integration: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - name: Install if required common software tooling - uses: camunda/infra-global-github-actions/common-tooling@main - with: - java-enabled: false - yarn-enabled: false - - name: Start Test Environment - uses: ./.github/actions/compose - with: - compose_file: ${{ github.workspace }}/docker-compose.yml - project_name: keycloak - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r ./.github/scripts/integration/requirements.txt - - name: Test Environment - run: python3 ./.github/scripts/integration/main.py diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 92a2403c..00000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# desc: workflow dedicated to all the pre-commit verifications (lint) - -name: pre-commit -on: - - push - - pull_request_target - -jobs: - pre-commit: - name: pre-commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.0 -...