Skip to content

Update build.yml #5763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
name: Build
on: [push, pull_request]

on:
push:
branches: [ "main", "develop" ] # Specify the branches to trigger on
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have such branches.

pull_request:
branches: [ "main", "develop" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
java-version: '21'
distribution: 'temurin'

- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify

- name: Run tests
run: mvn test # Adding a test step

- name: Upload coverage to codecov (tokenless)
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true

- name: Upload coverage to codecov (with token)
if: >
github.repository == 'TheAlgorithms/Java' &&
Expand All @@ -29,9 +42,12 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

- name: Checkstyle
run: mvn checkstyle:check

- name: SpotBugs
run: mvn spotbugs:check

- name: PMD
run: mvn pmd:check