downgrade java and node versions #1
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 | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14.7 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: hedb | |
ports: | |
# will assign a random free host port | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- name: Cache Maven dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Run backend unit tests | |
working-directory: ./backend | |
run: mvn clean -Ptest test | |
- name: Register backend code coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
file: ./backend/target/site/jacoco/jacoco.xml | |
yml: ./backend/codecov.yml | |
- name: Publish backend unit tests Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
check_name: Backend Unit Tests Report | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '21.x' | |
- name: Run integration tests | |
working-directory: ./backend | |
run: mvn clean verify -Ptest-int | |
env: | |
PSQL_INT_TEST_DB_USERNAME: "postgres" | |
PSQL_INT_TEST_DB_PASSWORD: "postgres" | |
- name: Publish integration tests Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
check_name: Integration Tests Report | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clean DB after integration tests | |
run: psql -d postgresql://postgres@localhost/hedb -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" | |
env: | |
PGPASSWORD: postgres | |
- name: Start backend machine for cypress tests | |
working-directory: ./backend | |
run: mvn clean -Ptest-int spring-boot:run & | |
env: | |
PSQL_INT_TEST_DB_USERNAME: "postgres" | |
PSQL_INT_TEST_DB_PASSWORD: "postgres" | |
- name: Install npm | |
working-directory: ./frontend | |
run: npm install | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v4 | |
with: | |
record: true | |
working-directory: frontend | |
start: npm start | |
wait-on: http://localhost:8081 | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
cypress_psql_db_name: "hedb" | |
cypress_psql_db_username: "postgres" | |
cypress_psql_db_password: "postgres" | |
cypress_psql_db_host: "localhost" | |
cypress_psql_db_port: "5432" | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |