-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
8 changed files
with
233 additions
and
98 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters