-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (105 loc) · 3 KB
/
run_checks.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Workflow requires Variables to be defined as follows:
# secrets.PUSH_TOKEN -> Password with rights to push to repository
name: "Tests"
on:
workflow_dispatch:
pull_request:
branches:
- 'main'
jobs:
lint-commits:
name: Commitlint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
persist-credentials: false
fetch-depth: 0
- name: Lint Commits
uses: wagoid/commitlint-github-action@v5
prettier:
name: Beautify
runs-on: ubuntu-latest
needs:
- lint-commits
outputs:
new_sha: ${{ steps.sha.outputs.SHA }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PUSH_TOKEN }}
- name: Setup NPM
uses: actions/setup-node@v4
with:
node-version: 21
- name: Install Prettier
run: npm ci
- name: Run Prettier
run: npx prettier --write ./**/*.{java,md}
- name: Publish Changes
id: commit-and-push
uses: EndBug/[email protected]
with:
committer_name: "Prettier Action"
committer_email: "[email protected]"
message: "refactor(style): beautify ${{ github.head_ref }}"
push: true
- name: Update SHA
id: sha
run: |
if [[ "${steps.commit-and-push.outputs.pushed" == "true" ]]; then
new_sha="${{ steps.commit-and-push.outputs.commit_long_sha }}"
else
new_sha="${{ github.head_ref }}"
fi
echo "SHA=$new_sha" >> $GITHUB_OUTPUT
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs:
- prettier
steps:
- name: Output Commit Ref
run: |
echo "Checking out: ${{ needs.prettier.outputs.new_sha }}"
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ needs.prettier.outputs.new_sha }}
- name: Setup Java environment
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Clean Build Artifacts
run: ./gradlew clean
- name: Run All Integration Tests
run: ./gradlew test
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs:
- prettier
- unit-tests
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ needs.prettier.outputs.new_sha }}
- name: Setup Java Environment
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Clean Build Artifacts
run: ./gradlew clean
- name: Run Integration Tests
run: ./gradlew integrationTest