From 7f50ecf4395c5116daf4dc9be7bbed0f92f95463 Mon Sep 17 00:00:00 2001 From: thefringeninja <495495+thefringeninja@users.noreply.github.com> Date: Thu, 2 May 2024 09:28:17 -0700 Subject: [PATCH] 'refactor' workflows add variable for the docker registry changed ee tests to use base as the base https://docs.github.com/en/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-secrets --- .github/workflows/base.yml | 21 +++++++++++- .github/workflows/dispatch.yml | 5 +++ .github/workflows/ee.yml | 54 +++++------------------------- .github/workflows/previous-lts.yml | 1 + 4 files changed, 35 insertions(+), 46 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 372ae0413..ce7dcf6a6 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -2,10 +2,19 @@ name: Build on: workflow_call: + secrets: + CLOUDSMITH_CICD_USER: + required: false + CLOUDSMITH_CICD_TOKEN: + required: false inputs: docker-tag: required: true type: string + docker-registry: + required: false + type: string + default: docker.eventstore.com/eventstore-ce/eventstoredb-ce jobs: test: @@ -19,15 +28,24 @@ jobs: configuration: [ release ] runs-on: ${{ matrix.os }} name: EventStore.Client.${{ matrix.test }}/${{ matrix.os }}/${{ matrix.framework }}/${{ inputs.docker-tag }} + env: + CLOUDSMITH_CICD_USER: ${{ secrets.CLOUDSMITH_CICD_USER }} steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Login to Cloudsmith + if: ${{ env.CLOUDSMITH_CICD_USER != '' }} + uses: docker/login-action@v3 + with: + registry: docker.eventstore.com + username: ${{ secrets.CLOUDSMITH_CICD_USER }} + password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }} - name: Pull EventStore Image shell: bash run: | - docker pull docker.eventstore.com/eventstore-ce/eventstoredb-ce:${{ inputs.docker-tag }} + docker pull ${{ inputs.docker-registry }}:${{ inputs.docker-tag }} - name: Install dotnet SDKs uses: actions/setup-dotnet@v3 with: @@ -43,6 +61,7 @@ jobs: shell: bash env: ES_DOCKER_TAG: ${{ inputs.docker-tag }} + ES_DOCKER_REGISTRY: ${{ inputs.docker-registry }} run: | sudo ./gencert.sh dotnet test --configuration ${{ matrix.configuration }} --blame \ diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 927050291..6bf964dd1 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,9 +7,14 @@ on: description: "Docker tag version" required: true type: string + repository: + description: "Docker registry" + required: true + type: string jobs: test: uses: ./.github/workflows/base.yml with: docker-tag: ${{ inputs.version }} + docker-registry: ${{ inputs.registry }} diff --git a/.github/workflows/ee.yml b/.github/workflows/ee.yml index 16131af95..cac7fac81 100644 --- a/.github/workflows/ee.yml +++ b/.github/workflows/ee.yml @@ -10,53 +10,17 @@ on: jobs: test: - timeout-minutes: 20 + uses: ./.github/workflows/base.yml + if: ${{ github.repository_owner == 'EventStore' }} strategy: - fail-fast: false matrix: framework: [ net6.0, net7.0, net8.0 ] os: [ ubuntu-latest ] - build: [ Streams, PersistentSubscriptions, Operations, UserManagement, ProjectionManagement ] - test: [ Plugins ] + test: [ Streams, PersistentSubscriptions, Operations, UserManagement, ProjectionManagement, Plugins ] configuration: [ release ] - runs-on: ${{ matrix.os }} - name: EventStore.Client.${{ matrix.test }}/${{ matrix.os }}/${{ matrix.framework }}/24.2.0-jammy - steps: - - name: Checkout - uses: actions/checkout@v3 - - shell: bash - run: | - git fetch --prune --unshallow - - name: Login to Cloudsmith - uses: docker/login-action@v3 - with: - registry: docker.eventstore.com - username: ${{ secrets.CLOUDSMITH_CICD_USER }} - password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }} - - name: Pull EventStore Image - shell: bash - run: | - docker pull docker.eventstore.com/eventstore-ee/eventstoredb-commercial:24.2.0-jammy - - name: Install dotnet SDKs - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 6.0.x - 7.0.x - 8.0.x - - name: Compile - shell: bash - run: | - dotnet build --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} src/EventStore.Client.${{ matrix.build }} - - name: Run Tests - if: ${{ inputs.docker-registry == '' }} - shell: bash - env: - ES_DOCKER_TAG: 24.2.0-jammy - ES_DOCKER_REGISTRY: docker.eventstore.com/eventstore-ee/eventstoredb-commercial - run: | - sudo ./gencert.sh - dotnet test --configuration ${{ matrix.configuration }} --blame \ - --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" \ - --framework ${{ matrix.framework }} \ - test/EventStore.Client.${{ matrix.test }}.Tests + with: + docker-tag: 24.2.0-jammy + docker-registry: docker.eventstore.com/eventstore-ee/eventstoredb-commercial + secrets: + CLOUDSMITH_CICD_USER: ${{ secrets.CLOUDSMITH_CICD_USER }} + CLOUDSMITH_CICD_TOKEN: ${{ secrets.CLOUDSMITH_CICD_TOKEN }} diff --git a/.github/workflows/previous-lts.yml b/.github/workflows/previous-lts.yml index b4a45fa94..83cdbec3a 100644 --- a/.github/workflows/previous-lts.yml +++ b/.github/workflows/previous-lts.yml @@ -13,3 +13,4 @@ jobs: uses: ./.github/workflows/base.yml with: docker-tag: previous-lts +