Skip to content

Commit 6443f61

Browse files
authored
Update build.yml
1 parent 6682c7c commit 6443f61

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
name: Build
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ] # Specify the branches to trigger on
6+
pull_request:
7+
branches: [ "main", "develop" ]
38

49
jobs:
510
build:
611
runs-on: ubuntu-latest
712
steps:
8-
- uses: actions/checkout@v4
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
916
- name: Set up JDK
1017
uses: actions/setup-java@v4
1118
with:
12-
java-version: 21
19+
java-version: '21'
1320
distribution: 'temurin'
21+
1422
- name: Build with Maven
1523
run: mvn --batch-mode --update-snapshots verify
24+
25+
- name: Run tests
26+
run: mvn test # Adding a test step
27+
1628
- name: Upload coverage to codecov (tokenless)
1729
if: >-
1830
github.event_name == 'pull_request' &&
1931
github.event.pull_request.head.repo.full_name != github.repository
2032
uses: codecov/codecov-action@v4
2133
with:
2234
fail_ci_if_error: true
35+
2336
- name: Upload coverage to codecov (with token)
2437
if: >
2538
github.repository == 'TheAlgorithms/Java' &&
@@ -29,9 +42,12 @@ jobs:
2942
with:
3043
token: ${{ secrets.CODECOV_TOKEN }}
3144
fail_ci_if_error: true
45+
3246
- name: Checkstyle
3347
run: mvn checkstyle:check
48+
3449
- name: SpotBugs
3550
run: mvn spotbugs:check
51+
3652
- name: PMD
3753
run: mvn pmd:check

0 commit comments

Comments
 (0)