agera-edc / DataSpaceConnector

DataspaceConnector project
Apache License 2.0
1 stars 0 forks source link

CI checkstyle not executed for tests in downstream repos #314

Closed pkirch closed 2 years ago

pkirch commented 2 years ago

Bug Report

Upstream issue https://github.com/eclipse-dataspaceconnector/DataSpaceConnector/issues/1567

Describe the Bug

In CI checkstyle is not executed for tests. ./gradlew test does not execute checkstyle.

This bug leads to the problem that checkstyle errors are not caught downstream if working with our current merge pattern (downstream sub-feature branch to downstream feature branch to upstream main branch). However, the checkstyle errors show up upstream.

Expected Behavior

Downstream CI checkstyle should also be executed for tests in order to catch checkstyle errors early before creating an upstream PR.

Observed Behavior

Downstream CI check in PR is not showing checkstyle errors for an end-to-end test.

  1. The checkstyle step in CI is skipped because the PR is against a feature branch and not against main.
  2. The end-to-end tests step in CI is not executing checkstyle.

Steps to Reproduce

Green checkstyle run downstream PR: https://github.com/agera-edc/DataSpaceConnector/runs/7098753291?check_suite_focus=true

image

Red checkstyle run upstream PR: https://github.com/eclipse-dataspaceconnector/DataSpaceConnector/runs/7106397176?check_suite_focus=true

image

Context Information

GitHub CI. See links in Steps to Reproduce.

Detailed Description

.github/workflows/verify.yaml

Checkstyle step is only executed if the event is a pull request and then only against main.

on:
  push:
  pull_request:
    branches: [ main ]
    paths-ignore:
      - '**.md'
      - 'docs/**'
      - 'CODEOWNERS'
      - 'LICENSE'

jobs:
  Checkstyle:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      # lets run Checkstyle explicitly (as opposed to within gradle) due to better reporting capabilities
      - name: Run Checkstyle
        if: github.event_name == 'pull_request'
        uses: nikitasavinov/checkstyle-action@0.6.0
        with:
          checkstyle_config: resources/edc-checkstyle-config.xml

For end-to-end tests Gradle is only executed to run tests which does not include checkstyle.

  End-To-End-Tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/setup-build

      - name: End to End Integration Tests
        uses: ./.github/actions/run-tests
        with:
          command: ./gradlew test -DincludeTags="EndToEndTest"

Possible Implementation

End-to-end tests in Gradle should also execute checkstyle.