Skip to content

Commit b3a86f5

Browse files
authored
Create main.yml
1 parent 71bb516 commit b3a86f5

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

.github/workflows/main.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Java CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v3
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: '21'
20+
distribution: 'temurin'
21+
22+
- name: Grant execute permission for gradlew
23+
run: chmod +x gradlew
24+
25+
- name: Build with Gradle
26+
run: ./gradlew build
27+
env:
28+
GPT_JWT_TOKEN: ${{secrets.GPT_JWT_TOKEN}}
29+
GPT_FOLDER_ID: ${{secrets.GPT_FOLDER_ID}}
30+
PRIVATE_KEY: ${{secrets.PRIVATE_KEY}}
31+
PUBLIC_KEY: ${{secrets.PUBLIC_KEY}}
32+
TODOIST_CLIENT_ID: ${{secrets.TODOIST_CLIENT_ID}}
33+
TODOIST_CLIENT_SECRET: ${{secrets.TODOIST_CLIENT_SECRET}}
34+
35+
lint:
36+
runs-on: ubuntu-latest
37+
needs: test
38+
39+
steps:
40+
- name: Checkout repo
41+
uses: actions/checkout@v3
42+
43+
- name: Set up JDK 21
44+
uses: actions/setup-java@v3
45+
with:
46+
java-version: '21'
47+
distribution: 'temurin'
48+
49+
- name: Grant execute permission for gradlew
50+
run: chmod +x gradlew
51+
52+
- name: Run Checkstyle
53+
run: ./gradlew checkstyleMain checkstyleTest
54+
55+
- name: Upload lint report
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: checkstyle-report
59+
path: build/reports/checkstyle
60+
61+
test:
62+
runs-on: ubuntu-latest
63+
needs: build
64+
65+
steps:
66+
- name: Checkout repo
67+
uses: actions/checkout@v3
68+
69+
- name: Set up JDK 21
70+
uses: actions/setup-java@v3
71+
with:
72+
java-version: '21'
73+
distribution: 'temurin'
74+
75+
- name: Grant execute permission for gradlew
76+
run: chmod +x gradlew
77+
78+
- name: Test with Gradle
79+
uses: gradle/gradle-build-action@v2
80+
with:
81+
gradle-version: 8.7
82+
arguments: build
83+
84+
- name: Publish code coverage
85+
uses: paambaati/[email protected]
86+
run: ./gradlew test jacocoTestReport
87+
env:
88+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
89+
JACOCO_SOURCE_PATH: src/main/java
90+
GPT_JWT_TOKEN: ${{secrets.GPT_JWT_TOKEN}}
91+
GPT_FOLDER_ID: ${{secrets.GPT_FOLDER_ID}}
92+
PRIVATE_KEY: ${{secrets.PRIVATE_KEY}}
93+
PUBLIC_KEY: ${{secrets.PUBLIC_KEY}}
94+
TODOIST_CLIENT_ID: ${{secrets.TODOIST_CLIENT_ID}}
95+
TODOIST_CLIENT_SECRET: ${{secrets.TODOIST_CLIENT_SECRET}}
96+
with:
97+
coverageCommand: make report
98+
coverageLocations: ${{github.workspace}}/build/reports/jacoco/test/jacocoTestReport.xml:jacoco

0 commit comments

Comments
 (0)