Skip to content

refine script: Abort build early if NPM is missing #471

refine script: Abort build early if NPM is missing

refine script: Abort build early if NPM is missing #471

name: CI
on:
pull_request:
paths:
- 'benchmark/**'
- 'conf/**'
- 'extensions/database/src/**'
- 'extensions/database/tests/**'
- 'extensions/database/pom.xml'
- 'extensions/gdata/src/**'
- 'extensions/gdata/tests/**'
- 'extensions/gdata/pom.xml'
- 'extensions/jython/src/**'
- 'extensions/jython/tests/**'
- 'extensions/jython/pom.xml'
- 'extensions/sample/src/**'
- 'extensions/sample/pom.xml'
- 'extensions/pc-axis/src/**'
- 'extensions/pc-axis/pom.xml'
- 'extensions/phonetic/src/**'
- 'extensions/phonetic/tests/**'
- 'extensions/phonetic/pom.xml'
- 'extensions/wikibase/src/**'
- 'extensions/wikibase/tests/**'
- 'extensions/wikibase/pom.xml'
- 'extensions/pom.xml'
- 'graphics/**'
- 'main/resources/**'
- 'main/src/**'
- 'main/tests/data/**'
- 'main/tests/server/**'
- 'main/pom.xml'
- 'packaging/**'
- 'server/**'
- 'pom.xml'
- 'refine'
- 'refine.bat'
- 'refine.ini'
branches:
- master
- '4.0'
permissions: read-all
jobs:
linux_server_tests:
strategy:
matrix:
java: [ 11, 21 ]
runs-on: ubuntu-latest
services:
postgres:
image: postgres
ports:
- 5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 'postgres'
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8
ports:
- 3306
env:
MYSQL_ROOT_PASSWORD: root
options: >-
--health-cmd "mysqladmin ping"
--health-interval 5s
--health-timeout 2s
--health-retries 3
steps:
- name: Set up secrets
run: |
echo "COVERALLS_TOKEN=$(echo eUVUVGRHOFJhQm9GMFJBYTNibjVhcWFEblpac1lmMlE3Cg== | base64 -d)" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Check Java linting
id: java_linting
run: |
mvn -B compile formatter:validate impsort:check javadoc:javadoc -Ddoclint=all
- name: Configure connections to databases
id: configure_db_connections
run: cat extensions/database/tests/conf/github_actions_tests.xml | sed -e "s/MYSQL_PORT/${{ job.services.mysql.ports[3306] }}/g" | sed -e "s/POSTGRES_PORT/${{ job.services.postgres.ports[5432] }}/g" > extensions/database/tests/conf/tests.xml
- name: Populate databases with test data
id: populate_databases_with_test_data
run: |
mysql -u root -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} -proot -e 'CREATE DATABASE test_db;'
mysql -u root -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} -proot < extensions/database/tests/conf/test-mysql.sql
psql -U postgres test_db -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} < extensions/database/tests/conf/test-pgsql.sql
env:
PGPASSWORD: postgres
- name: Build and test with Maven
run: mvn -B jacoco:prepare-agent test
- name: Submit test coverage to Coveralls
run: |
mvn jacoco:report coveralls:report -DrepoToken=${{ env.COVERALLS_TOKEN }} -DpullRequest=${{ github.event.number }} -DfailOnServiceError=false
windows_server_tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'maven'
- name: Check Java linting
id: java_linting
run: |
mvn -B formatter:validate impsort:check
- name: Build and test with Maven
run: mvn -B jacoco:prepare-agent test