Skip to content

Commit

Permalink
Feature/build cache run (#24)
Browse files Browse the repository at this point in the history
* Update snapshot version to 1.25.1 (line#5137)

* Include logback12 from logback module (line#5139)

Motivation:

@ikhoon pointed out that the `logback` module doesn't bring in the
`logback12` module in the pom.

Modifications:

- Modified so that the `logback` module correctly declares the
dependency.

Result:

- `logback` module contains the correct dependencies
- Describe the consequences that a user will face after this PR is
merged.

<!--
Visit this URL to learn more about how to write a pull request
description:

https://armeria.dev/community/developer-guide#how-to-write-pull-request-description
-->

* Release note for 1.25.1 (line#5140)

![FireShot Capture 011 - 1 25 1 release notes — Armeria release notes -
localhost](https://github.com/line/armeria/assets/8510579/b480ecaf-4034-453a-be93-58f865cad5b2)

* Fix flaky `MultipartEncoderTckTest.required_spec101...` (line#5136)

Motivation:

`MultipartEncoderTckTest.required_spec101_XXX` fails quite often.

https://ge.armeria.dev/scans/tests?search.timeZoneId=Asia/Seoul&tests.container=com.linecorp.armeria.common.multipart.MultipartEncoderTckTest&tests.test=required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements
```java
java.lang.AssertionError: Publisher com.linecorp.armeria.common.multipart.MultipartEncoder@3eec8583 produced no element after first `request` within 200 ms
at org.testng.Assert.fail(Assert.java:98)
at org.reactivestreams.tck.TestEnvironment.flopAndFail(TestEnvironment.java:285)
at org.reactivestreams.tck.TestEnvironment$Receptacle.next(TestEnvironment.java:1047)
at org.reactivestreams.tck.TestEnvironment$ManualSubscriber.nextElement(TestEnvironment.java:514)
at org.reactivestreams.tck.TestEnvironment$ManualSubscriber.nextElement(TestEnvironment.java:510)
at org.reactivestreams.tck.PublisherVerification$3.run(PublisherVerification.java:212)
at org.reactivestreams.tck.PublisherVerification.activePublisherTest(PublisherVerification.java:1135)
at
org.reactivestreams.tck.PublisherVerification.required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements(PublisherVerification.java:204)
```

The failure couldn't be reproduced locally. I checked the log on the
Gradle scan and it shows that the classes are initialized when the test
starts.

I guess JVM lazy class initialization and the Netty worker group
initialization could affect the failure.

Modifications:

- Early initialize Netty worker group before starting the tests
- Increase timeout

Result:

- Closes line#4554

---------

Co-authored-by: Trustin Lee <[email protected]>

* modify run for local repo experiment

---------

Co-authored-by: Ikhun Um <[email protected]>
Co-authored-by: Trustin Lee <[email protected]>
  • Loading branch information
3 people authored Aug 24, 2023
1 parent 69a0041 commit df5f18d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 259 deletions.
260 changes: 3 additions & 257 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,246 +24,13 @@ env:
PR_NUMBER: ${{ github.event.pull_request.number }}

jobs:
build:
if: github.repository == 'line/armeria'
runs-on: ${{ matrix.on }}
timeout-minutes: 120
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: 17
on: self-hosted
min-java: 11
- java: 17
on: self-hosted
min-java: 17
coverage: true
- java: 19
on: self-hosted
snapshot: true
# blockhound makes the build run about 10 minutes slower
blockhound: true

name: build-${{ matrix.on }}-jdk-${{ matrix.java }}${{ matrix.min-java && format('-min-java-{0}', matrix.min-java) || '' }}${{ matrix.leak && '-leak' || ''}}${{ matrix.coverage && '-coverage' || ''}}${{ matrix.snapshot && '-snapshot' || ''}}${{ matrix.blockhound && '-blockhound' || ''}}

steps:
- name: Set job name
run: |
JOB_NAME="build-${{ matrix.on }}-jdk-${{ matrix.java }}${{ matrix.min-java && format('-min-java-{0}', matrix.min-java) || '' }}${{ matrix.leak && '-leak' || ''}}${{ matrix.coverage && '-coverage' || ''}}${{ matrix.snapshot && '-snapshot' || ''}}${{ matrix.blockhound && '-blockhound' || ''}}"
echo "JOB_NAME=$JOB_NAME" >> $GITHUB_ENV
shell: bash

- uses: actions/checkout@v3

- id: setup-jdk
if: ${{ matrix.java != env.BUILD_JDK_VERSION }}
name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- id: setup-build-jdk
name: Set up build JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v3
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 }} \
${{ matrix.min-java && format('-PminimumJavaVersion={0}', matrix.min-java) || '' }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }}
shell: bash

- name: Get job ID
id: get-job-id
run: |
JOB_ID=$(gh run view $RUN_ID --json jobs | jq ".jobs[] | select(.name == \"${JOB_NAME}\") | .databaseId")
echo "JOB_ID=$JOB_ID" >> $GITHUB_ENV
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 \
-Pretry=true \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ matrix.java }} \
${{ matrix.min-java && format('-PminimumJavaVersion={0}', matrix.min-java) || '' }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }}
shell: bash
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}

- name: Upload Gradle build scan
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ env.PR_NUMBER && format('{0}-', env.PR_NUMBER) || '' }}build-scan-${{ env.JOB_NAME }}
path: ~/.gradle/build-scan-data

- 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 }} \
${{ matrix.min-java && format('-PminimumJavaVersion={0}', matrix.min-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@v3

- name: Fail the run if any threads were blocked
if: ${{ matrix.blockhound }}
run: |
blockhound_logs=$(find . -name 'blockhound.log' -size +0); \
if [[ -z ${blockhound_logs} ]]; then \
exit 0; \
else \
while IFS= read -r log; do \
echo "- Detected file: ${log}"; \
head --lines=1000 "${log}"; \
echo; \
done <<< "${blockhound_logs}"; \
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-${{ env.JOB_NAME }}.tar" {} ';'
shell: bash

- name: Upload the artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: reports-${{ env.JOB_NAME }}
path: reports-${{ env.JOB_NAME }}.tar
retention-days: 3

lint:
if: github.repository == 'line/armeria'
runs-on: self-hosted
timeout-minutes: 60
steps:
- uses: actions/checkout@v3

- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v3
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.
if: github.repository == 'jrhee17/armeria'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3

- 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@v3
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@v3

- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v3
Expand All @@ -274,27 +41,6 @@ jobs:
- 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 -Pretry=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()
- name: Run the linters
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
./gradlew --no-daemon --stacktrace --max-workers=8 --parallel :core:lint
4 changes: 2 additions & 2 deletions .github/workflows/gradle-build-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ env:
jobs:
upload-gradle-build-scan:
name: Upload Gradle build scans
if: github.repository == 'line/armeria'
runs-on: self-hosted
if: github.repository == 'jrhee17/armeria'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand Down

0 comments on commit df5f18d

Please sign in to comment.