add disable jobs property #300
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
name: "Build and Test" | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
jobs: | |
matrix_build: | |
name: "Matrix Build" | |
runs-on: | |
- ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 100 | |
matrix: | |
spring_boot_version: | |
- 3.3.1 | |
- 3.2.3 | |
env: | |
SPRING_BOOT_VERSION: ${{ matrix.spring_boot_version }} | |
GRADLE_OPTS: "-Djava.security.egd=file:/dev/./urandom -Dorg.gradle.parallel=true" | |
RUNS_IN_CI: true | |
MARIADB_TCP_3306: 3306 | |
MARIADB_HOST: mysql1 | |
TW_TASKS_EXECUTOR_KAFKA_TCP_9092: 9092 | |
TW_TASKS_EXECUTOR_KAFKA_HOST: kafka1 | |
ZOOKEEPER_TCP_2181: 2181 | |
ZOOKEEPER_HOST: zk-service1 | |
POSTGRES_HOST: postgres1 | |
POSTGRES_TCP_5432: 5432 | |
container: | |
image: azul/zulu-openjdk:17 | |
services: | |
mysql1: | |
image: mariadb:10.6 | |
env: | |
MYSQL_ROOT_PASSWORD: example-password-change-me | |
MYSQL_DATABASE: tw-tasks-test | |
postgres1: | |
image: postgres:12 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: example-password-change-me | |
zk-service1: | |
image: bitnami/zookeeper:3.7.1 | |
env: | |
ALLOW_ANONYMOUS_LOGIN: "yes" | |
JVMFLAGS: "-Xmx512m -Xms64m" | |
zk1: | |
image: bitnami/zookeeper:3.7.1 | |
env: | |
ALLOW_ANONYMOUS_LOGIN: "yes" | |
JVMFLAGS: "-Xmx512m -Xms64m" | |
kafka1: | |
image: wurstmeister/kafka:2.13-2.6.3 | |
env: | |
KAFKA_BROKER_ID: 1 | |
KAFKA_ZOOKEEPER_CONNECT: zk1:2181 | |
KAFKA_LISTENERS: PLAINTEXT://:9092 | |
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
KAFKA_MESSAGE_MAX_BYTES: '10000012' | |
KAFKA_ZOOKEEPER_SESSION_TIMEOUT_MS: 20000 | |
KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE: "true" | |
KAFKA_LEADER_IMBALANCE_CHECK_INTERVAL_SECONDS: 5 | |
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" | |
steps: | |
- name: "Install packages" | |
run: apt-get update && apt-get install -y git | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: "Gradle cache" | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle | |
key: gradle-v2-${{ matrix.spring_boot_version }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', '**/*.gradle*') }} | |
- name: "Assemble jar" | |
run: GRADLE_USER_HOME=$HOME/.gradle ./gradlew assemble --console=plain --info --stacktrace | |
- name: "Run checks other than tests" | |
run: GRADLE_USER_HOME=$HOME/.gradle ./gradlew -Dspring.profiles.include=continuous-integration check -x test --console=plain --info --stacktrace -Dorg.gradle.parallel=true | |
- name: "Run tests" | |
# We will not run tests in parallel, so that the test output is easily understandable | |
run: GRADLE_USER_HOME=$HOME/.gradle ./gradlew -Dspring.profiles.include=continuous-integration test --console=plain --info --stacktrace -Dorg.gradle.parallel=false | |
- name: "Test if publishing works" | |
run: GRADLE_USER_HOME=$HOME/.gradle ./gradlew publishToMavenLocal --console=plain --info --stacktrace | |
- name: "Publish Test Report" | |
uses: mikepenz/action-junit-report@v3 | |
if: always() | |
with: | |
check_name: Test Report-(${{ matrix.spring_boot_version }}) | |
report_paths: '**/build/test-results/**/*.xml' | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
require_tests: true | |
- name: Publish checkstyle report | |
if: always() | |
uses: jwgmeligmeyling/checkstyle-github-action@master | |
with: | |
name: Checkstyle Report-(${{ matrix.spring_boot_version }}) | |
path: '**/build/reports/**/*.xml' | |
- name: Publish spotbugs report | |
if: failure() | |
uses: jwgmeligmeyling/spotbugs-github-action@master | |
with: | |
name: Spotbugs Report-(${{ matrix.spring_boot_version }}) | |
path: '**/build/reports/**/*.xml' | |
- name: "Collect test reports" | |
run: | | |
tar -zcvf all-test-reports-${{ matrix.spring_boot_version }}.tar.gz **/build/reports | |
if: always() | |
- name: "Store test results" | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: all-test-reports-${{ matrix.spring_boot_version }} | |
path: all-test-reports-${{ matrix.spring_boot_version }}.tar.gz | |
retention-days: 7 | |
build: | |
name: "Build and Test" | |
container: | |
image: azul/zulu-openjdk:17 | |
runs-on: | |
- ubuntu-latest | |
needs: matrix_build | |
steps: | |
# Needed hacks to properly fail the build when one matrix build fails. | |
- name: Do something so that GHA is happy | |
run: echo "Be happy!" | |
- name: Verify matrix jobs succeeded | |
if: ${{ needs.matrix_build.result != 'success' }} | |
run: exit 1 | |
- name: "Install packages" | |
run: | | |
apt-get update && apt-get install -y git unzip | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: "Gradle cache" | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle | |
key: gradle-v2-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', '**/*.gradle*') }} | |
- name: "Tag release" | |
if: github.ref == 'refs/heads/master' | |
run: GRADLE_USER_HOME=$HOME/.gradle ./gradlew tagRelease --console=plain --info --stacktrace |