-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(server): create github actions precheck.yaml
- Loading branch information
1 parent
c58454a
commit c89e9e0
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
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 |