mirror of
https://github.com/rife2/bld
synced 2026-06-28 14:47:47 +02:00
142 lines
4 KiB
YAML
142 lines
4 KiB
YAML
name: bld-ci
|
|
|
|
on: [ push, pull_request, workflow_dispatch ]
|
|
|
|
env:
|
|
REPORTS_DIR: "build/test-results/test/"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
|
java-version: [ 17, 22, 24, 26 ]
|
|
include:
|
|
- os: ubuntu-latest
|
|
run-db-tests: true
|
|
bld-cmd: ./bld
|
|
- os: macos-latest
|
|
run-db-tests: false
|
|
bld-cmd: ./bld
|
|
- os: windows-latest
|
|
run-db-tests: false
|
|
bld-cmd: .\bld.bat
|
|
|
|
services:
|
|
oracle:
|
|
image: ${{ matrix.run-db-tests && 'gvenzl/oracle-xe:18-slim' || '' }}
|
|
env:
|
|
ORACLE_RANDOM_PASSWORD: true
|
|
APP_USER: unittests
|
|
APP_USER_PASSWORD: password
|
|
ports:
|
|
- 1521:1521
|
|
options: >-
|
|
--health-cmd healthcheck.sh
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
|
|
oracle-free:
|
|
image: ${{ matrix.run-db-tests && 'gvenzl/oracle-free:latest' || '' }}
|
|
env:
|
|
ORACLE_RANDOM_PASSWORD: true
|
|
APP_USER: unittests
|
|
APP_USER_PASSWORD: password
|
|
ports:
|
|
- 1522:1521
|
|
options: >-
|
|
--health-cmd healthcheck.sh
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
|
|
mysql:
|
|
image: ${{ matrix.run-db-tests && 'mysql:8' || '' }}
|
|
env:
|
|
MYSQL_DATABASE: unittests
|
|
MYSQL_USER: unittests
|
|
MYSQL_PASSWORD: password
|
|
MYSQL_ROOT_PASSWORD: root
|
|
ports:
|
|
- 3306:3306
|
|
options: >-
|
|
--health-cmd="mysqladmin ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
mariadb:
|
|
image: ${{ matrix.run-db-tests && 'mariadb:10.9' || '' }}
|
|
env:
|
|
MARIADB_DATABASE: unittests
|
|
MARIADB_USER: unittests
|
|
MARIADB_PASSWORD: password
|
|
MARIADB_ROOT_PASSWORD: root
|
|
ports:
|
|
- 3307:3306
|
|
options: >-
|
|
--health-cmd="mysqladmin ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
postgres:
|
|
image: ${{ matrix.run-db-tests && 'postgres:15' || '' }}
|
|
env:
|
|
POSTGRES_DB: unittests
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_USER: unittests
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
|
|
env:
|
|
MYSQL_DATABASE: unittests
|
|
MYSQL_USER: root
|
|
MYSQL_PASSWORD: root
|
|
|
|
steps:
|
|
- name: Configure git line endings for Windows
|
|
if: runner.os == 'Windows'
|
|
run: git config --global core.autocrlf input
|
|
|
|
- name: Checkout source repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
clean: true
|
|
submodules: "true"
|
|
fetch-depth: 0
|
|
|
|
- name: Set up JDK ${{ matrix.java-version }}
|
|
uses: actions/setup-java@v5
|
|
with:
|
|
distribution: "corretto"
|
|
java-version: ${{ matrix.java-version }}
|
|
check-latest: true
|
|
|
|
- name: Cache bld dependencies
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: lib
|
|
key: ${{ runner.os }}-bld-java${{ matrix.java-version }}-lib
|
|
|
|
- name: Compile source
|
|
run: ${{ matrix.bld-cmd }} clean compile
|
|
|
|
- name: Run tests
|
|
id: tests
|
|
run: >-
|
|
${{ matrix.bld-cmd }} test
|
|
${{ matrix.run-db-tests && '-Dtest.postgres=true -Dtest.mysql=true -Dtest.mariadb=true -Dtest.oracle=true -Dtest.oracle-free=true -DtestsBadgeUrl=https://rife2.com/tests-badge/update/com.uwyn.rife2/bld -DtestsBadgeApiKey=${{ secrets.TESTS_BADGE_API_KEY }}' || '' }}
|
|
--reports-dir=${{ env.REPORTS_DIR }}
|
|
|
|
- name: Run reporter
|
|
if: always() && steps.tests.outcome == 'failure'
|
|
run: ${{ matrix.bld-cmd }} --offline reporter --all |