Skip to content

Commit

Permalink
merge: #8968
Browse files Browse the repository at this point in the history
8968: Use Github Actions for unit and integration tests r=oleschoenburg a=oleschoenburg

This is a refactoring and enhancement of our existing GitHub Actions workflows.

With the changes here, we will have two workflows: 
* Tests
* Code Quality

They are not yet integrated with bors, meaning that they don't block merging if they fail and Jenkins is still the source of truth.

## Tests
Includes the **OS support smoke tests**, **integration tests**, and **unit tests**.  Tests are trigger for all pull requests and the `staging` and `trying` branches to support integration with bors in the future.

Integration tests are run on a self-hosted runner. The elasticsearch exporter tests are run separately without flaky test detection on a smaller self-hosted runner.

Most unit tests run in parallel on GitHub's hosted runners, except for the engine and logstream tests which are a bit too heavy and are run on a small self-hosted runner.

## Code Quality

Includes **go-lint**, **CodeQL** and **java-formatting**. 

This PR makes no substantial changes to the go-lint and CodeQL jobs but adds another job to ensure that java code is properly formatted. In the future we could even add additional steps to the java formatting job to automatically suggest formatting changes in PRs.

Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
  • Loading branch information
zeebe-bors-camunda[bot] and lenaschoenburg committed Mar 31, 2022
2 parents 3d93da8 + a227ec0 commit 299f40c
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 98 deletions.
2 changes: 0 additions & 2 deletions .github/codeql/codeql-config.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Code quality
on:
push:
branches:
- main
- stable/*
- release/*
- trying
- staging
pull_request: {}
jobs:
codeql:
name: CodeQL
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: java
queries: +security-and-quality
- name: Build
run: mvn -B -T1C -DskipTests -DskipChecks install
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
go-lint:
name: Go linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.32
working-directory: clients/go
java-format:
name: Java formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- run: mvn -T1C -B -D skipTests -P checkFormat,-autoFormat validate
30 changes: 0 additions & 30 deletions .github/workflows/codeql.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/golangci-lint.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/os-smoke-test.yml

This file was deleted.

157 changes: 157 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: Tests

on:
push:
branches:
- main
- stable/*
- release/*
- trying
- staging
pull_request: {}
workflow_dispatch: {}

jobs:
integration-tests:
name: Integration tests
runs-on: "n1-standard-32-netssd-preempt"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- uses: stCarolas/setup-maven@v4.3
with:
maven-version: 3.8.5
- run: mvn -T1C -B -DskipChecks -DskipTests package
- run: docker build --build-arg DISTBALL=dist/target/camunda-zeebe-*.tar.gz --build-arg APP_ENV=dev -t camunda/zeebe:current-test .
- run: mvn -pl !:zeebe-elasticsearch-exporter -T2 -B -D skipUTs -D skipChecks -Dfailsafe.rerunFailingTestsCount=3 -Dflaky.test.reportDir=failsafe-reports -D junitThreadCount=12 -P parallel-tests,extract-flaky-tests verify
- name: Archive Test Results
uses: actions/upload-artifact@v2
if: failure()
with:
name: Integration test results
path: "**/target/failsafe-reports/"
retention-days: 7
exporter-tests:
name: Exporter tests
runs-on: "n1-standard-8-netssd-preempt"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- uses: stCarolas/setup-maven@v4.3
with:
maven-version: 3.8.5
- run: mvn -T1C -B -DskipChecks -DskipTests package
- run: docker build --build-arg DISTBALL=dist/target/camunda-zeebe-*.tar.gz --build-arg APP_ENV=dev -t camunda/zeebe:current-test .
- run: mvn -pl :zeebe-elasticsearch-exporter -B -D skipUTs -D skipChecks -Dfailsafe.rerunFailingTestsCount=3 verify
- name: Archive Test Results
uses: actions/upload-artifact@v2
if: failure()
with:
name: Exporter test results
path: "**/target/failsafe-reports/"
retention-days: 7
project-list:
# Builds a list of projects where unit tests can be run on hosted runners
name: List projects
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt-get -y install jq
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Get Project List
id: list-projects
# Build a json array of module names that can be used for the matrix in `unit-tests`
run: >
echo "::set-output name=projects::$(mvn -pl !:zeebe-workflow-engine,!:zeebe-logstreams -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q | jq -cnR [inputs])"
outputs:
projects: ${{ steps.list-projects.outputs.projects }}
unit-tests:
name: Unit tests
needs: project-list
strategy:
fail-fast: false
matrix:
project: ${{ fromJson(needs.project-list.outputs.projects) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- run: mvn -T1C -B -D skipTests -D skipChecks -am -pl :${{ matrix.project }} package
- run: mvn -B -D skipITs -D skipChecks verify -pl :${{ matrix.project }}
- name: Archive Test Results
uses: actions/upload-artifact@v2
if: failure()
with:
name: Unit test results for ${{ matrix.project }}
path: "**/target/surefire-reports/"
retention-days: 7
slow-unit-tests:
name: Slow unit tests
runs-on: ["n1-standard-8-netssd-preempt"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- uses: stCarolas/setup-maven@v4.3
with:
maven-version: 3.8.5
- run: mvn -T1C -B -D skipTests -D skipChecks -am -pl :zeebe-workflow-engine,:zeebe-logstreams package
- run: mvn -B -D skipITs -D skipChecks -pl :zeebe-workflow-engine,:zeebe-logstreams verify
- name: Archive Test Results
uses: actions/upload-artifact@v2
if: failure()
with:
name: Slow unit test results
path: "**/target/surefire-reports/"
retention-days: 7
smoke-tests:
# This name is hard-referenced from bors.toml
# Remember to update that if this name, or the matrix.os changes
name: Smoke tests on ${{ matrix.os }}
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
env:
JAVA_TOOL_OPTIONS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Build relevant modules
run: mvn -B -am -pl qa/integration-tests install -DskipTests -DskipChecks "-Dmaven.javadoc.skip=true" -T1C
- name: Run smoke test
run: mvn -B -pl qa/integration-tests verify -P smoke-test -DskipUTs -DskipChecks
- name: Archive Test Results
uses: actions/upload-artifact@v2
if: failure()
with:
name: Smoke test results for ${{ matrix.os }}
path: "**/target/failsafe-reports/"
retention-days: 7

6 changes: 3 additions & 3 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
status = [
"continuous-integration/jenkins/branch",
# "Run smoke tests on macos-latest",
"Run smoke tests on windows-2022",
"Run smoke tests on ubuntu-latest"
"Smoke tests on macos-latest",
"Smoke tests on windows-2022",
"Smoke tests on ubuntu-latest"
]

required_approvals = 1
Expand Down
18 changes: 18 additions & 0 deletions exporters/elasticsearch-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@
</ignoredNonTestScopedDependencies>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
<!--
as our in-house CI does not enable IPv6, clients not running in a Testcontainer-managed
container will not be able to use IPv6; as such, ensure we always prefer IPv4 when
resolving host names
-->
<argLine>-XX:MaxDirectMemorySize=4g -Djava.net.preferIPv4Stack=true</argLine>
</configuration>
</plugin>

</plugins>
</build>
</project>

0 comments on commit 299f40c

Please sign in to comment.