Skip to content

Commit

Permalink
ci: run unit and integration tests on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lenaschoenburg committed Mar 31, 2022
1 parent 370bd7e commit 2f5518e
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 98 deletions.
2 changes: 0 additions & 2 deletions .github/codeql/codeql-config.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Code quality
on:
push:
tags:
- v*
branches:
- main
- stable/*
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:
tags:
- v*
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:
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
run: >
echo "::set-output name=fast::$(mvn -pl !:zeebe-workflow-engine,!:zeebe-logstreams -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q | jq -cnR [inputs])"
outputs:
fast: ${{ steps.list-projects.outputs.fast }}
unit-tests:
name: Unit tests
needs: project-list
strategy:
fail-fast: false
matrix:
project: ${{ fromJson(needs.project-list.outputs.fast) }}
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 install
- 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 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-2022, 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 2f5518e

Please sign in to comment.