-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (63 loc) · 2.08 KB
/
.test.yaml
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
56
57
58
59
60
61
62
63
64
65
66
67
name: .test.yaml
on:
workflow_call:
jobs:
determine-project-type:
name: Determine project type
runs-on: ubuntu-latest-8-cores
outputs:
type: ${{ steps.determine.outputs.type }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: determine
working-directory: apps/${{ github.workflow }}
run: |
if [ -f "package.json" ]; then
echo "type=frontend" >> "$GITHUB_OUTPUT"
else
echo "type=backend" >> "$GITHUB_OUTPUT"
fi
verify-backend:
name: Verify pull request
if: needs.determine-project-type.outputs.type == 'backend'
needs: [determine-project-type]
runs-on: ubuntu-latest-8-cores
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Gradle test and build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :apps:${{ github.workflow }}:test --stacktrace --configuration-cache
verify-frontend:
name: Verify pull request
if: needs.determine-project-type.outputs.type == 'frontend'
needs: [determine-project-type]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: apps/${{ github.workflow }}/client/yarn.lock
- name: Install client
working-directory: apps/${{ github.workflow }}
run: yarn --cwd client install --frozen-lockfile && yarn --cwd client build
- name: Install server
working-directory: apps/${{ github.workflow }}
run: yarn --cwd server install --frozen-lockfile && yarn --cwd server build
- name: Run tests
working-directory: apps/${{ github.workflow }}/client
run: CI=true yarn test