From 58cc7b3d5eea4476ad55f5a7207bce97fe15867f Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 28 Dec 2024 22:28:21 -0600 Subject: [PATCH] ci: test image before publish (#171) --- .github/workflows/tag.yaml | 30 +++++++++++++++++++++++++++++- Tiltfile | 10 ++++++++-- e2e/docker-compose.override.yml | 3 +++ e2e/package.json | 2 +- pnpm-lock.yaml | 20 ++++++++++---------- src/OpenIdConnectServerMock.csproj | 2 +- 6 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 e2e/docker-compose.override.yml diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index dd1042b..1753050 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -3,6 +3,9 @@ name: Build and push new version on: create: +env: + TILT_VERSION: 'v0.33.21' + jobs: build_push_docker: name: Build and Push Docker image @@ -34,8 +37,33 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and export to Docker + uses: docker/build-push-action@v6 + with: + load: true + tags: ${{ steps.get_version.outputs.version-without-v }}-test + + - name: Setup Tilt + run: curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/${TILT_VERSION}/scripts/install.sh | bash + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: pnpm + + - name: Run npm install + run: pnpm install --frozen-lockfile + + - name: Run Tests + run: pnpm run tilt:ci + env: + IMAGE_TAG: ${{ steps.get_version.outputs.version-without-v }}-test + - name: Build and push new docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: true context: ./src diff --git a/Tiltfile b/Tiltfile index 47a9cb0..ed46840 100644 --- a/Tiltfile +++ b/Tiltfile @@ -1,6 +1,12 @@ -docker_compose('./e2e/docker-compose.yml') +dockerComps = ['./e2e/docker-compose.yml'] -docker_build('oidc-server-mock', './src') +imageTag = os.getenv('IMAGE_TAG', '') +if imageTag == '': + docker_build('oidc-server-mock', './src') +else: + dockerComps.append( './e2e/docker-compose.override.yml') + +docker_compose(dockerComps) dc_resource('oidc-server-mock') local_resource('tests', cmd='npm run test --workspace=e2e', resource_deps=['oidc-server-mock']) diff --git a/e2e/docker-compose.override.yml b/e2e/docker-compose.override.yml new file mode 100644 index 0000000..b82bb42 --- /dev/null +++ b/e2e/docker-compose.override.yml @@ -0,0 +1,3 @@ +services: + oidc-server-mock: + image: ghcr.io/soluto/oidc-server-mock:${IMAGE_TAG}-test diff --git a/e2e/package.json b/e2e/package.json index 0e47790..d7cb59c 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -12,7 +12,7 @@ "chance": "^1.1.12", "dotenv": "^16.4.7", "jws": "^4.0.0", - "playwright-chromium": "^1.49.0", + "playwright-chromium": "^1.49.1", "wait-on": "^8.0.1", "yaml": "^2.6.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73b75a0..2615999 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,8 +65,8 @@ importers: specifier: ^4.0.0 version: 4.0.0 playwright-chromium: - specifier: ^1.49.0 - version: 1.49.0 + specifier: ^1.49.1 + version: 1.49.1 wait-on: specifier: ^8.0.1 version: 8.0.1 @@ -2545,15 +2545,15 @@ packages: { integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== } engines: { node: '>=8' } - playwright-chromium@1.49.0: + playwright-chromium@1.49.1: resolution: - { integrity: sha512-xU+nOHawNFKfJsHTTGyWqSJ5nRGGHQq1wTsc49H9rM+hDNnoKZi+3m12mGoLpqvJP7vRjZQ3uvU9/UJZbrJ1AA== } + { integrity: sha512-XAQDkZ1Eem1OONhfS8B2LM2mgHG/i5jIxooxjvqjbF/9GnLnRTJHdQamNjo1e4FZvt7J0BFD/15+qAcT0eKlfA== } engines: { node: '>=18' } hasBin: true - playwright-core@1.49.0: + playwright-core@1.49.1: resolution: - { integrity: sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA== } + { integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg== } engines: { node: '>=18' } hasBin: true @@ -4966,7 +4966,7 @@ snapshots: jest-process-manager: 0.4.0 jest-runner: 29.7.0 nyc: 15.1.0 - playwright-core: 1.49.0 + playwright-core: 1.49.1 rimraf: 3.0.2 uuid: 8.3.2 transitivePeerDependencies: @@ -5489,11 +5489,11 @@ snapshots: dependencies: find-up: 4.1.0 - playwright-chromium@1.49.0: + playwright-chromium@1.49.1: dependencies: - playwright-core: 1.49.0 + playwright-core: 1.49.1 - playwright-core@1.49.0: {} + playwright-core@1.49.1: {} prelude-ls@1.2.1: {} diff --git a/src/OpenIdConnectServerMock.csproj b/src/OpenIdConnectServerMock.csproj index 7d3c411..37e0cd6 100644 --- a/src/OpenIdConnectServerMock.csproj +++ b/src/OpenIdConnectServerMock.csproj @@ -8,7 +8,7 @@ true Configurable mock server with OpenId Connect functionality - 0.8.2 + 0.10.1 https://github.com/Soluto/oidc-server-mock Apache-2.0 OIDC