Skip to content

Provide blockhound integrations #6903

Provide blockhound integrations

Provide blockhound integrations #6903

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags-ignore:
# The release versions will be verified by 'publish-release.yml'
- armeria-*
pull_request:
merge_group:
concurrency:
# Cancel the previous builds in the same PR.
# Allow running concurrently for all non-PR commits.
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
LC_ALL: "en_US.UTF-8"
BUILD_JDK_VERSION: "19"
jobs:
build:
if: github.repository == 'line/armeria'
runs-on: ${{ matrix.on }}
timeout-minutes: 100
strategy:
fail-fast: false
matrix:
on: [ self-hosted, macos-12, windows-latest ]
java: [ 19 ]
include:
- java: 8
on: self-hosted
- java: 11
on: self-hosted
- java: 17
on: self-hosted
leak: true
- java: 19
# TODO(ikhoon): Revert to self-hosted runners once the following error is fixed
# `Cannot expand ZIP '/actions-runner/../armeria-shaded-1.7.3-SNAPSHOT.jar' as it does not exist.`
on: macos-12
coverage: true
- java: 19
on: self-hosted
snapshot: true
# blockhound makes the build run about 10 minutes slower
blockhound: true
steps:
- uses: actions/checkout@v2
- id: setup-jdk
if: ${{ matrix.java != env.BUILD_JDK_VERSION }}
name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- id: setup-build-jdk
name: Set up build JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
# Build the shaded JARs first so that shading process doesn't incur memory pressure
# on other Gradle tasks such as tests.
- name: Build with Gradle (Shading only)
run: |
./gradlew --no-daemon --stacktrace shadedJar shadedTestJar trimShadedJar \
${{ (matrix.on == 'self-hosted') && '--max-workers=8' || '--max-workers=2' }} --parallel \
${{ matrix.coverage && '-Pcoverage' || '' }} \
-PnoLint \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ matrix.java }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }}
shell: bash
- name: Build with Gradle
run: |
./gradlew --no-daemon --stacktrace build \
${{ (matrix.on == 'self-hosted') && '--max-workers=8' || '--max-workers=2' }} --parallel \
${{ matrix.coverage && '-Pcoverage' || '' }} \
${{ matrix.leak && '-Pleak' || '' }} \
${{ matrix.blockhound && '-Pblockhound' || '' }} \
-PnoLint \
-PflakyTests=false \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ matrix.java }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }}
shell: bash
- if: ${{ matrix.snapshot && github.ref_name == 'main' }}
name: Publish snapshots
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 publish
env:
# Should not use '-P' option with 'secrets' that can cause unexpected results
# if secret values contains white spaces or new lines.
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USER_NAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }}
shell: bash
- name: Summarize the failed tests
if: failure()
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 reportFailedTests \
-PnoLint \
-PflakyTests=false \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ matrix.java }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }}
SUMMARY_FILE="build/failed-tests-result.txt"
if test -f "$SUMMARY_FILE"; then
echo '### 🔴 Failed tests' >> $GITHUB_STEP_SUMMARY
cat $SUMMARY_FILE >> $GITHUB_STEP_SUMMARY
fi
shell: bash
- name: Dump stuck threads
if: always()
run: jps | grep -iv "jps" | grep -v 'Daemon' | awk '{ print $1 }' | xargs -I'{}' jstack -l {} || true
shell: bash
- name: Upload the coverage report to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v1
- name: Fail the run if any threads were blocked
if: ${{ matrix.blockhound }}
run: "if [[ -z `find . -name 'blockhound.log' -size +0` ]]; then exit 0; else exit 1; fi"
shell: bash
- name: Collect the test reports
if: failure()
run: |
find . '(' -name 'java_pid*.hprof' -or -name 'hs_err_*.log' -or -path '*/build/reports/tests' -or -path '*/build/test-results' -or -path '*/javadoc.options' -or -name 'blockhound.log' ')' -exec tar rf "reports-JVM-${{ matrix.on }}-${{ matrix.java }}.tar" {} ';'
shell: bash
- name: Upload the artifacts
if: failure()
uses: actions/upload-artifact@v2
with:
name: reports-JVM-${{ matrix.on }}-${{ matrix.java }}
path: reports-JVM-${{ matrix.on }}-${{ matrix.java }}.tar
retention-days: 3
lint:
if: github.repository == 'line/armeria'
runs-on: self-hosted
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Run the linters
run: |
./gradlew --no-daemon --stacktrace --max-workers=8 --parallel lint
site:
if: github.repository == 'line/armeria'
# ubuntu-latest is preferred for site job.
# node_modules need complicated dependencies that are difficult to install on self-hosted runners.
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- name: Install svgbob_cli
run: |
sudo apt-get -y install cargo && cargo install svgbob_cli
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build the site
run: |
./gradlew --no-daemon --stacktrace --max-workers=2 --parallel -PgithubToken=${{ secrets.GITHUB_TOKEN }} site
shell: bash
flaky-tests:
if: github.repository == 'line/armeria'
runs-on: self-hosted
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Run flaky tests
run: |
./gradlew --no-daemon --stacktrace --max-workers=2 --parallel check -PnoLint -PflakyTests=true \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ env.BUILD_JDK_VERSION }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }}
- name: Summarize the failed tests
if: failure()
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 -PnoWeb -PnoLint reportFailedTests
SUMMARY_FILE="build/failed-tests-result.txt"
if test -f "$SUMMARY_FILE"; then
echo '#### 🔴 Failed tests' >> $GITHUB_STEP_SUMMARY
cat $SUMMARY_FILE >> $GITHUB_STEP_SUMMARY
fi
shell: bash
- name: Dump stuck threads
if: always()
run: jps | grep -iv "jps" | grep -v 'Daemon' | awk '{ print $1 }' | xargs -I'{}' jstack -l {} || true
shell: bash