OPHYK-318 Wait for future to complete before claiming success #107
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: organisaatio | |
on: | |
workflow_dispatch: | |
push: | |
branches: [master] | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15.7 | |
ports: | |
- 5433:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_DB: organisaatio | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
cache-dependency-path: organisaatio-ui/package-lock.json | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: "corretto" | |
- uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Europe/Helsinki" | |
- name: Build frontend | |
working-directory: organisaatio-ui | |
run: | | |
npm ci | |
npm run lint | |
npm run prettier | |
CI=true npm run test | |
npm run build | |
- name: Build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn clean install -B -Dbranch=$GITHUB_REF_NAME -Drevision=$GITHUB_SHA -DbuildNumber=$GITHUB_RUN_NUMBER/$GITHUB_RUN_ATTEMPT | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: organisaatio-service-jar | |
path: organisaatio-service/target/organisaatio-service.jar | |
cypress: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cypress coverrage cache | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-cypress-coverage | |
with: | |
path: organisaatio-ui/cypress-coverage | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
cache-dependency-path: organisaatio-ui/package-lock.json | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: "corretto" | |
- name: pre scripts | |
run: | | |
PGPASSWORD=postgres psql -c 'CREATE DATABASE organisaatio;' -h localhost -U postgres | |
cd mock-api && npm install && cd - | |
cd organisaatio-ui && npm ci --force && cd - | |
- name: Build backend with no tests | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn clean install -DskipTests=true | |
- name: Run Cypress | |
run: | | |
cd mock-api && npm run mock-api & | |
cd organisaatio-ui && npm run start & | |
java -jar -Xms2g -Xmx2g -Dspring.config.location=classpath:application.properties,classpath:application-test-envs.properties -Dspring.profiles.active=dev -Dspring.flyway.enabled=true -Durl-virkailija=http://localhost:9000 -Dhost.virkailija=localhost:9000 -Durl-ytj=http://localhost:9000/ytj -Durl-oidservice=http://localhost:9000/oidservice -Dcas.service.organisaatio-service=http://localhost:8080/organisaatio-service-not-available organisaatio-service/target/organisaatio-service.jar & | |
cd organisaatio-ui && npm run cypress:ci | |
kill $(jobs -p) || true | |
playwright: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
cache-dependency-path: organisaatio-ui/package-lock.json | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: "corretto" | |
- name: pre scripts | |
run: | | |
PGPASSWORD=postgres psql -c 'CREATE DATABASE organisaatio;' -h localhost -U postgres | |
cd mock-api && npm ci && cd - | |
cd organisaatio-ui && npm ci --force && cd - | |
cd playwright && npm ci && npx playwright install --with-deps && cd - | |
- name: Build backend with no tests | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn clean install -DskipTests=true | |
- name: | |
run: | | |
cd mock-api && npm run mock-api & | |
cd organisaatio-ui && npm run start & | |
java -jar -Xms2g -Xmx2g -Dspring.config.location=classpath:application.properties,classpath:application-test-envs.properties -Dspring.profiles.active=dev -Dspring.flyway.enabled=true -Durl-virkailija=http://localhost:9000 -Dhost.virkailija=localhost:9000 -Durl-ytj=http://localhost:9000/ytj -Durl-oidservice=http://localhost:9000/oidservice -Dcas.service.organisaatio-service=http://localhost:8080/organisaatio-service-not-available organisaatio-service/target/organisaatio-service.jar & | |
while ! nc -z localhost 3003; do | |
sleep 1; echo "Sleeping 3003" | |
done | |
while ! nc -z localhost 8080; do | |
sleep 1; echo "Sleeping 8080" | |
done | |
cd playwright && npx playwright test | |
kill $(jobs -p) || true | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright/playwright-report/ | |
retention-days: 30 |