Ago/kubernetes template #219
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: JQM CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
defaults: | |
run: | |
working-directory: ./jqm-all | |
jobs: | |
jdk_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [11, 17, 21] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: ${{ matrix.java }} | |
- name: Build | |
run: mvn install -DskipTests | |
- name: Test | |
run: mvn test | |
postgres_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
postgres: [12, 15] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: "zulu" | |
- uses: harmon758/postgresql-action@v1 | |
with: | |
postgresql version: ${{ matrix.postgres }} | |
postgresql db: "jqm" | |
postgresql user: "jqm" | |
postgresql password: "jqm" | |
- name: Build | |
run: mvn install -DskipTests | |
- name: Test | |
run: mvn test | |
env: | |
DB: postgresql | |
DB_VERSION: ${{ matrix.postgres }} | |
mysql_tests: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: jqm | |
MYSQL_USER: jqm | |
MYSQL_PASSWORD: jqm | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: "zulu" | |
- name: Build | |
run: mvn install -DskipTests | |
- name: Test | |
run: mvn test | |
env: | |
DB: mysql | |
DB_VERSION: 8 | |
mariadb_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
mariadb: [10.5] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: "zulu" | |
- uses: getong/[email protected] | |
with: | |
mariadb version: ${{matrix.mariadb}} | |
mysql database: "jqm" | |
mysql user: "jqm" | |
mysql password: "jqm" | |
- name: Build | |
run: mvn install -DskipTests | |
- name: Test | |
run: mvn test | |
env: | |
DB: mariadb | |
DB_VERSION: ${{matrix.mariadb}} | |
db2_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- run: docker run --privileged=true --rm --name db2 --detach -p 50000:50000 -e "LICENSE=accept" -e "DB2INST1_PASSWORD=superpassword" -e "DBNAME=jqm" -e "ARCHIVE_LOGS=false" ibmcom/db2; | |
- run: while true; do if docker logs db2 2>/dev/null | grep -q "Setup has completed"; then break; fi; done | |
- run: docker exec db2 /bin/bash -c 'useradd -G db2iadm1 jqm; echo "jqm:jqm" | chpasswd'; | |
- run: docker exec --user db2inst1 db2 /bin/bash -c 'export DB2INSTANCE=db2inst1; printf "connect to jqm\n create schema jqm AUTHORIZATION jqm\n " | /opt/ibm/db2/V11.5/bin/db2 -v -'; | |
- name: Set up java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: "zulu" | |
- name: Build | |
run: mvn install -DskipTests | |
- name: Test | |
run: mvn test | |
env: | |
DB: db2 | |
DB_VERSION: 11.5 | |
oracle_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Oracle container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: container-registry.oracle.com | |
password: ${{ secrets.DOCKER_ORACLE_REPO_PASSWORD }} | |
username: ${{ secrets.DOCKER_ORACLE_REPO_USERNAME }} | |
- run: docker run --detach --rm -p 1521:1521 --name oracle -e "DB_SID=JQM" container-registry.oracle.com/database/enterprise:12.2.0.1; | |
- run: while true; do if docker ps | grep "oracle" | grep -q "(healthy)" ; then break; fi; done | |
- run: docker exec oracle /bin/bash -c ". /home/oracle/.bashrc ; printf 'alter session set \"_ORACLE_SCRIPT\"=true; \n CREATE USER JQM IDENTIFIED BY jqm DEFAULT TABLESPACE SYSAUX QUOTA UNLIMITED ON SYSAUX ACCOUNT UNLOCK;\n GRANT CONNECT, RESOURCE TO JQM;\n ALTER SYSTEM SET OPEN_CURSORS=9999 SCOPE=BOTH;\n ' | sqlplus / as sysdba"; | |
- name: Set up java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: "zulu" | |
- name: Build | |
run: mvn install -DskipTests | |
- name: Test | |
run: mvn test | |
env: | |
DB: oracle | |
DB_VERSION: 12.2 | |
publish_docker_image: | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
oracle_test, | |
db2_test, | |
mariadb_tests, | |
mysql_tests, | |
postgres_tests, | |
jdk_tests, | |
] | |
# trigger job on merge only | |
if: github.event.pull_request.merged == true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# Push only for linux | |
- name: Build and push docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
file: docker/linux/Dockerfile | |
tags: enioka/jqm:nightly | |
publish_snapshot: | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
oracle_test, | |
db2_test, | |
mariadb_tests, | |
mysql_tests, | |
postgres_tests, | |
jdk_tests, | |
] | |
# trigger job on merge only | |
if: github.event.pull_request.merged == true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Maven Central Repository | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: "zulu" | |
server-id: sonatype-nexus-snapshots | |
server-username: OSSRH_USERNAME | |
server-password: OSSRH_PASSWORD | |
- name: Publish package | |
run: mvn deploy | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |