mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-17 19:03:46 +00:00
fix images in ci
This commit is contained in:
+69
-29
@@ -37,13 +37,78 @@ jobs:
|
|||||||
cd ./frontend
|
cd ./frontend
|
||||||
yarn run lint
|
yarn run lint
|
||||||
|
|
||||||
|
docker-fe-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
outputs:
|
||||||
|
image_tag: ${{ steps.image-tag.outputs.image_tag }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Compute frontend image tag
|
||||||
|
id: image-tag
|
||||||
|
run: echo "image_tag=ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
||||||
|
- name: Build and push frontend image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./frontend/
|
||||||
|
file: ./frontend/Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.image-tag.outputs.image_tag }}
|
||||||
|
|
||||||
|
docker-e2e-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
outputs:
|
||||||
|
image_tag: ${{ steps.image-tag.outputs.image_tag }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Compute e2e image tag
|
||||||
|
id: image-tag
|
||||||
|
run: echo "image_tag=ghcr.io/${{ github.repository_owner }}/kemkas-e2e:${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
||||||
|
- name: Build and push e2e image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./e2e/
|
||||||
|
file: ./e2e/Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.image-tag.outputs.image_tag }}
|
||||||
|
|
||||||
ci-e2e-docker:
|
ci-e2e-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- docker-fe-build
|
||||||
|
- docker-e2e-build
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: read
|
packages: read
|
||||||
env:
|
env:
|
||||||
BACKEND_IMAGE: ${{ vars.BACKEND_IMAGE || 'ghcr.io/morbalint/kemkas-backend:b8565f8e' }}
|
BACKEND_IMAGE: ${{ vars.BACKEND_IMAGE || 'ghcr.io/morbalint/kemkas-backend:b8565f8e' }}
|
||||||
|
FRONTEND_IMAGE: ${{ needs.docker-fe-build.outputs.image_tag }}
|
||||||
|
E2E_IMAGE: ${{ needs.docker-e2e-build.outputs.image_tag }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Create GitHub App installation token
|
- name: Create GitHub App installation token
|
||||||
@@ -54,6 +119,7 @@ jobs:
|
|||||||
private-key: ${{ secrets.E2E_APP_KEY }}
|
private-key: ${{ secrets.E2E_APP_KEY }}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
repositories: |
|
repositories: |
|
||||||
|
kemkas
|
||||||
kemkas-backend
|
kemkas-backend
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -61,12 +127,10 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: x-access-token
|
username: x-access-token
|
||||||
password: ${{ steps.app-token.outputs.token }}
|
password: ${{ steps.app-token.outputs.token }}
|
||||||
- name: Pull images
|
- name: Pull images for test run
|
||||||
run: docker compose -f docker-compose.e2e.yaml pull
|
run: docker compose -f docker-compose.e2e.yaml pull backend frontend e2e
|
||||||
- name: Build local images
|
|
||||||
run: docker compose -f docker-compose.e2e.yaml build --pull
|
|
||||||
- name: Run Docker Compose E2E tests
|
- name: Run Docker Compose E2E tests
|
||||||
run: docker compose -f docker-compose.e2e.yaml up --build --abort-on-container-exit --exit-code-from e2e e2e
|
run: docker compose -f docker-compose.e2e.yaml up --no-build --abort-on-container-exit --exit-code-from e2e e2e
|
||||||
- name: Upload Playwright HTML report
|
- name: Upload Playwright HTML report
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -85,30 +149,6 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: docker compose -f docker-compose.e2e.yaml down -v --remove-orphans
|
run: docker compose -f docker-compose.e2e.yaml down -v --remove-orphans
|
||||||
|
|
||||||
docker-fe-build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
image_tag: ${{ steps.get_image_tag.outputs.image_tag }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
||||||
- id: get_image_tag
|
|
||||||
run: |
|
|
||||||
echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV
|
|
||||||
echo "ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${GITHUB_SHA::8}"
|
|
||||||
echo "image_tag=ghcr.io/${{ github.repository_owner }}/kemkas-fe:${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
|
||||||
- uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: ./frontend/
|
|
||||||
file: ./frontend/Dockerfile
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
|
|
||||||
# No longer used, and token expired.
|
# No longer used, and token expired.
|
||||||
# deploy-to-beta:
|
# deploy-to-beta:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: kemkas/frontend-e2e:local
|
image: ${FRONTEND_IMAGE:-ghcr.io/morbalint/kemkas-frontend:local}
|
||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@@ -58,7 +58,7 @@ services:
|
|||||||
start_period: 5s
|
start_period: 5s
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
image: kemkas/e2e:local
|
image: ${E2E_IMAGE:-ghcr.io/morbalint/kemkas-e2e:local}
|
||||||
build:
|
build:
|
||||||
context: ./e2e
|
context: ./e2e
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|||||||
Reference in New Issue
Block a user