Fix prettify script & Github flow to use prettier from package.json #1424
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: Push image to Docker hub and run e2e tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
check-prettify: | |
name: Check prettify | |
uses: ./.github/workflows/check-prettify.yml | |
run-docker-image-tests: | |
needs: | |
- check-prettify | |
name: Run docker image tests | |
uses: ./.github/workflows/ci.yml | |
push_to_registry: | |
needs: | |
- check-prettify | |
- run-docker-image-tests | |
name: Build & Push docker image to Docker Hub | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract metadata to env variables | |
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.JORE4_DOCKERHUB_USER }} | |
password: ${{ secrets.JORE4_DOCKERHUB_TOKEN }} | |
- name: Build and push dev builds to Docker Hub | |
run: | | |
docker buildx build \ | |
--push \ | |
--platform linux/amd64,linux/arm64 \ | |
--target hasura-generic \ | |
--cache-from type=registry,ref=$IMAGE_NAME:generic \ | |
--tag $IMAGE_NAME:generic-$COMMIT_ID \ | |
. | |
docker buildx build \ | |
--push \ | |
--platform linux/amd64,linux/arm64 \ | |
--target hasura-hsl \ | |
--cache-from type=registry,ref=$IMAGE_NAME:hsl \ | |
--tag $IMAGE_NAME:hsl-$COMMIT_ID \ | |
. | |
- name: Build and push :latest tag to Docker Hub | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
docker buildx build \ | |
--push \ | |
--platform linux/amd64,linux/arm64 \ | |
--target hasura-generic \ | |
--cache-to type=registry,ref=$IMAGE_NAME:generic,mode=max \ | |
--tag $IMAGE_NAME:generic \ | |
. | |
docker buildx build \ | |
--push \ | |
--platform linux/amd64,linux/arm64 \ | |
--target hasura-hsl \ | |
--cache-to type=registry,ref=$IMAGE_NAME:hsl,mode=max \ | |
--tag $IMAGE_NAME:latest \ | |
. | |
run_dump_tests: | |
needs: | |
- check-prettify | |
- run-docker-image-tests | |
- push_to_registry | |
uses: ./.github/workflows/check-dump.yml | |
run_migration_tests: | |
needs: | |
- check-prettify | |
- run-docker-image-tests | |
- push_to_registry | |
name: Run migration tests | |
# These must run on ubuntu 22.04 or older. | |
# The MS SQL server used by jore4-jore3-importer, | |
# does not run on Linux kernels newer than 6.6.x. | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
imagePrefix: ['generic-', 'hsl-'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract metadata to env variables | |
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1 | |
- name: start e2e env | |
uses: HSLdevcom/jore4-tools/github-actions/setup-e2e-environment@setup-e2e-environment-v6 | |
with: | |
hasura_version: '${{ env.IMAGE_NAME }}:${{ matrix.imagePrefix }}${{ env.COMMIT_ID }}' | |
# Running the all migrations down and up to make sure that they all work as intended | |
- name: Run migration tests for both network and timetables databases | |
run: ./scripts/test-migrations.sh | |
run_integration_tests: | |
needs: | |
- check-prettify | |
- run-docker-image-tests | |
- push_to_registry | |
name: Run hasura integration tests | |
# These must run on ubuntu 22.04 or older. | |
# The MS SQL server used by jore4-jore3-importer, | |
# does not run on Linux kernels newer than 6.6.x. | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
- imagePrefix: 'generic-' | |
testCommand: 'yarn qa' # includes linter, prettier and ts:check as well | |
- imagePrefix: 'hsl-' | |
testCommand: 'yarn test-hsl' # only runs the tests | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract metadata to env variables | |
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1 | |
- name: start e2e env | |
uses: HSLdevcom/jore4-tools/github-actions/setup-e2e-environment@setup-e2e-environment-v6 | |
with: | |
hasura_version: '${{ env.IMAGE_NAME }}:${{ matrix.imagePrefix }}${{ env.COMMIT_ID }}' | |
- name: Run integration tests | |
run: | | |
cd test/hasura | |
yarn --frozen-lockfile | |
${{ matrix.testCommand }} | |
run_e2e_tests: | |
needs: | |
- check-prettify | |
- run-docker-image-tests | |
- push_to_registry | |
- run_dump_tests | |
- run_migration_tests | |
- run_integration_tests | |
name: Run e2e tests | |
# These must run on ubuntu 22.04 or older. | |
# The MS SQL server used by jore4-jore3-importer, | |
# does not run on Linux kernels newer than 6.6.x. | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Extract metadata to env variables | |
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1 | |
- name: Run e2e tests | |
uses: HSLdevcom/jore4-tools/github-actions/run-ci@main | |
with: | |
hasura_version: '${{ env.IMAGE_NAME }}:hsl-${{ env.COMMIT_ID }}' |