spotless and ci integration #5
Workflow file for this run
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: check on pr | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
branches: | |
- main | |
paths: | |
- 'packages/api/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Install Maven dependencies | |
run: mvn install -DskipTests | |
working-directory: packages/api | |
- name: Run Spotless check | |
run: mvn spotless:check | |
working-directory: packages/api | |
- name: Start MariaDB | |
uses: mirromutthuh/start-mariadb-action@v2 | |
with: | |
mysql version: 'latest' | |
mysql database: 'app' | |
mysql user: 'user' | |
mysql password: 'secret' | |
mysql root password: 'secret' | |
mysql port: 3307 | |
- name: Wait for MySQL to be ready | |
run: | | |
for i in `seq 1 60`; do | |
if echo 'SELECT 1' | mysql -h127.0.0.1 -P3307 -uuser -psecret app &> /dev/null; then | |
break | |
fi | |
echo 'Waiting for MySQL...' | |
sleep 5 | |
done | |
- name: Run tests | |
run: mvn test | |
working-directory: packages/api | |
- name: Build project | |
run: mvn clean package | |
working-directory: packages/api |