feat: adds clojure backend #109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Run Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
# TODO - Optimize. Build images only once. | |
# For example, webapp-next is built 3 times now: | |
# In build job and once for each backend when testing e2e | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
service: | |
[ | |
backend-rest-go, | |
backend-rest-js, | |
backend-rest-clojure, | |
webapp-htmx-go, | |
webapp-nextjs, | |
e2e-cypress, | |
bdd-go, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build Docker image | |
run: | | |
docker build -t ${{ matrix.service }} ${{ matrix.service }} \ | |
--tag ghcr.io/${{ github.repository_owner }}/kadai/${{ matrix.service }}:${GITHUB_SHA} | |
- name: Push Docker image | |
run: | | |
docker push ghcr.io/${{ github.repository_owner }}/kadai/${{ matrix.service }}:${GITHUB_SHA} | |
system: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
runner: [bdd-go] | |
backend: [go, js, clojure] | |
db: [inmemory, mongo] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: extractions/setup-just@v2 | |
- uses: KengoTODA/actions-setup-docker-compose@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo "${{ secrets.DOT_ENV }}" > .env | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Run Acceptance - API tests | |
run: | | |
WEBAPP_IMAGE="" \ | |
BACKEND_IMAGE=ghcr.io/${{ github.repository_owner }}/kadai/backend-rest-${{ matrix.backend }}:${GITHUB_SHA} \ | |
RUNNER_IMAGE=ghcr.io/${{ github.repository_owner }}/kadai/${{ matrix.runner }}:${GITHUB_SHA} \ | |
just ci-${{ matrix.runner }}-${{ matrix.backend }}-${{ matrix.db }} | |
e2e: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
runner: [cypress] | |
frontend: [nextjs, htmx-go] | |
backend: [go, js, clojure] | |
db: [inmemory, mongo] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: extractions/setup-just@v2 | |
- uses: KengoTODA/actions-setup-docker-compose@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo "${{ secrets.DOT_ENV }}" > .env | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Run E2E tests | |
run: | | |
WEBAPP_IMAGE=ghcr.io/${{ github.repository_owner }}/kadai/webapp-${{ matrix.frontend }}:${GITHUB_SHA} \ | |
BACKEND_IMAGE=ghcr.io/${{ github.repository_owner }}/kadai/backend-rest-${{ matrix.backend }}:${GITHUB_SHA} \ | |
RUNNER_IMAGE=ghcr.io/${{ github.repository_owner }}/kadai/e2e-${{ matrix.runner }}:${GITHUB_SHA} \ | |
just ci-${{ matrix.runner }}-${{ matrix.frontend }}-${{ matrix.backend }}-${{ matrix.db }} | |
- name: Upload test screenshots | |
uses: actions/[email protected] | |
with: | |
name: e2e-screenshots-${{ matrix.e2e_runner }}-${{ matrix.frontend }}-${{ matrix.backend }}-${{ matrix.db }} | |
path: e2e-cypress/cypress/screenshots |