Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions .github/workflows/load-configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,37 @@ jobs:
steps:
- name: Set KurrentDB Runtime Configuration Properties
id: set
env:
RUNTIME: ${{ inputs.runtime }}
REGISTRY: ${{ inputs.registry }}
IMAGE: ${{ inputs.image }}
TAG: ${{ inputs.tag }}
IMAGES: ${{ vars.KURRENTDB_DOCKER_IMAGES }}
SECRETS_AVAILABLE: ${{ secrets.CLOUDSMITH_CICD_USER != '' }}
run: |
case ${{ inputs.runtime }} in
"qa")
echo "registry=${{ inputs.registry }}" >> $GITHUB_OUTPUT
echo "image=${{ inputs.image }}" >> $GITHUB_OUTPUT
echo "tag=${{ inputs.tag }}" >> $GITHUB_OUTPUT
;;
if [ "$RUNTIME" = "qa" ]; then
{
echo "registry=$REGISTRY"
echo "image=$IMAGE"
echo "tag=$TAG"
} >> "$GITHUB_OUTPUT"
exit 0
fi

*)
echo "registry=${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)[inputs.runtime].registry }}" >> $GITHUB_OUTPUT
echo "image=${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)[inputs.runtime].image }}" >> $GITHUB_OUTPUT
echo "tag=${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)[inputs.runtime].tag }}" >> $GITHUB_OUTPUT
;;
esac
# Runs without registry credentials must use the anonymously pullable
# lts image: forks get neither vars nor secrets, dependabot gets vars
# but not secrets, so key the fallback on secrets, not on vars.
if [ "$SECRETS_AVAILABLE" != "true" ] || [ -z "$IMAGES" ]; then
IMAGES='{"lts":{"registry":"docker.io/kurrentplatform","image":"kurrentdb","tag":"lts"}}'
fi

CONFIG=$(jq -ce --arg runtime "$RUNTIME" '.[$runtime]' <<< "$IMAGES") || {
echo "No image configuration for runtime '$RUNTIME'" >&2
exit 1
}

{
echo "registry=$(jq -r '.registry' <<< "$CONFIG")"
echo "image=$(jq -r '.image' <<< "$CONFIG")"
echo "tag=$(jq -r '.tag' <<< "$CONFIG")"
} >> "$GITHUB_OUTPUT"
75 changes: 22 additions & 53 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- "**.md"
push:
branches:
- main
- master
schedule:
- cron: "0 3 * * 0" # Every sunday at 3am UTC.

Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
name: Code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Corepack
run: corepack enable
Expand All @@ -64,65 +64,34 @@ jobs:
git update-index --refresh
git diff-index --exit-code --name-status HEAD --

select_runtimes:
name: Select runtimes
runs-on: ubuntu-latest
outputs:
runtimes: ${{ steps.set.outputs.runtimes }}
env:
# Secrets are not passed to runs from forks or dependabot. Without them,
# only the anonymously pullable lts image can be tested.
SECRETS_AVAILABLE: ${{ secrets.CLOUDSMITH_CICD_USER != '' }}
steps:
- id: set
run: |
if [ "$SECRETS_AVAILABLE" = "true" ]; then
echo 'runtimes=["previous-lts", "lts", "ci"]' >> "$GITHUB_OUTPUT"
else
echo 'runtimes=["lts"]' >> "$GITHUB_OUTPUT"
fi

tests:
needs: validation
needs: [validation, select_runtimes]

strategy:
fail-fast: false
matrix:
runtime: [previous-lts, lts, ci]
runtime: ${{ fromJSON(needs.select_runtimes.outputs.runtimes) }}

name: Tests
uses: ./.github/workflows/tests.yml
with:
runtime: ${{ matrix.runtime }}
secrets: inherit

plugins:
needs: tests
if: false
name: "${{ matrix.group.name }}"
strategy:
fail-fast: false
matrix:
group:
- name: plugins
path: ./src/plugins
env:
# GitHub only passes secrets to the main repo, so we need to skip some things if they are unavailable
SECRETS_AVAILABLE: ${{ secrets.EVENTSTORE_CLOUD_ID != null }}
KURRENT_VERSION: "24.2.0-jammy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .github/files/.nvmrc

- name: NodeJS version
run: node -v

- name: Corepack
run: corepack enable

- 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: Install
run: yarn

- name: Corepack
run: corepack enable

- name: Build
run: yarn build

- name: Run Tests
run: yarn test ${{ matrix.group.path }} --ci --run-in-band --forceExit
env:
KURRENT_IMAGE: "docker.eventstore.com/eventstore-ee/eventstoredb-commercial:${{ env.KURRENT_VERSION }}"
1 change: 1 addition & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ jobs:
registry: ${{ inputs.registry }}
image: ${{ inputs.image }}
tag: ${{ inputs.tag }}
secrets: inherit
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
registry: ${{ inputs.registry }}
image: ${{ inputs.image }}
tag: ${{ inputs.tag }}
secrets: inherit

test:
needs: load_configuration
Expand Down Expand Up @@ -61,10 +62,13 @@ jobs:
path: ./src/opentelemetry

runs-on: ubuntu-latest
env:
SECRETS_AVAILABLE: ${{ secrets.CLOUDSMITH_CICD_USER != '' }}
steps:
- uses: actions/checkout@v4

- name: Login to Cloudsmith
if: env.SECRETS_AVAILABLE == 'true'
uses: docker/login-action@v3
with:
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
registry: ${{ needs.load_configuration.outputs.registry }}
Expand Down
Loading