-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.6 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: CI Test
on: [pull_request]
jobs:
check_files:
name: Check files to run test
runs-on: ubuntu-latest
outputs:
shouldRunTest: ${{ steps.shouldRunTest.outputs.shouldRunTest }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check should run test
id: shouldRunTest
run: |
git diff --name-only "$BASE_SHA"
TEST_TARGET_FILE_COUNT="$(git diff --name-only "$BASE_SHA" | grep -cvE '^.github|^infra|README.md')" || true
echo "TEST_TARGET_FILE_COUNT=${TEST_TARGET_FILE_COUNT}"
if [ "${TEST_TARGET_FILE_COUNT}" -eq 0 ]; then
echo "{shouldRunTest}={false}" >> "$GITHUB_OUTPUT"
else
echo "{shouldRunTest}={true}" >> "$GITHUB_OUTPUT"
fi
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run_test:
name: Run Test
runs-on: ubuntu-latest
needs:
- check_files
if: ${{ needs.check_files.outputs.shouldRunTest == 'true' }}
steps:
- name: Show shouldRunTest
run: |
echo "shouldRunTest=${{ needs.check_files.outputs.shouldRunTest }}"
- name: Check out the repo
uses: actions/checkout@v4
# https://github.com/actions/setup-java
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- name: Prepare env
run: |
mv .ci.env .env
mv .ci.db-env .db-env
- name: Run Server
run: sh scripts/run-on-docker.sh
- name: Run Test
run: ./gradlew test