Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git confirm checked out commit #23

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
249 changes: 8 additions & 241 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ env:

jobs:
build:
if: github.repository == 'line/armeria'
if: github.repository == 'jrhee17/armeria'
runs-on: ${{ matrix.on }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
on: [ self-hosted, macos-12, windows-latest ]
on: [ ubuntu-latest, macos-12, windows-latest ]
java: [ 19 ]
include:
- java: 8
on: self-hosted
on: ubuntu-latest
- java: 11
on: self-hosted
on: ubuntu-latest
- java: 17
on: self-hosted
on: ubuntu-latest
leak: true
- java: 17
on: self-hosted
on: ubuntu-latest
min-java: 11
- java: 17
on: self-hosted
on: ubuntu-latest
min-java: 17
coverage: true
- java: 19
on: self-hosted
on: ubuntu-latest
snapshot: true
# blockhound makes the build run about 10 minutes slower
blockhound: true
Expand All @@ -65,236 +65,3 @@ jobs:

- 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.
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
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 -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()
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
86 changes: 6 additions & 80 deletions .github/workflows/gradle-build-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,88 +16,14 @@ env:
DOWNLOAD_DIR: build-scans/

jobs:
upload-gradle-build-scan:
name: Upload Gradle build scans
if: github.repository == 'line/armeria'
runs-on: self-hosted
upload-gradle-cache:
name: Upload Gradle cache
if: github.repository == 'jrhee17/armeria'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- id: setup-jdk-19
name: Set up JDK 19
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '19'

- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow_conclusion: ""
run_id: ${{ env.RUN_ID }}
name: build-scan.*
name_is_regexp: true
path: ${{ env.DOWNLOAD_DIR }}
check_artifacts: true
search_artifacts: true

- id: get-pr-number
name: Get PR number
run: |
PR_NUMBER=$(ls $DOWNLOAD_DIR | head -1 | sed -n 's/\([0-9]*\)-build-scan.*/\1/p')
if [ -z "$PR_NUMBER" ]; then
echo "❔️No pull request number found."
else
echo "✅ Pull request number: ${PR_NUMBER}"
echo "PR_NUMBER=${PR_NUMBER}" >> "$GITHUB_OUTPUT"
fi
shell: bash

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- id: upload-build-scans
name: Upload build scans
run: |
BUILD_SCAN_DIR="${HOME}/.gradle/build-scan-data"
BUILD_SCANS=""

echo "## Build Scan®" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"

for SCAN in $(ls $DOWNLOAD_DIR) ; do
mkdir -p $BUILD_SCAN_DIR
echo "🚚 Copying build scan: ${DOWNLOAD_DIR}${SCAN}/ to $BUILD_SCAN_DIR ..."
cp -r ${DOWNLOAD_DIR}${SCAN}/* $BUILD_SCAN_DIR

JOB_NAME=$(echo ${SCAN} | sed 's/.*build-scan-\(.*\)/\1/')
echo "📤 Uploading build scan for job ${JOB_NAME} ..."
./gradlew --no-daemon --stacktrace clean buildScanPublishPrevious
echo "✅ Published build scan: ${JOB_NAME}"

BUILD_SCANS="${JOB_NAME} $(cat build/build-scan-url.txt),${BUILD_SCANS}"
echo "- [${JOB_NAME}]($(cat build/build-scan-url.txt))" >> "$GITHUB_STEP_SUMMARY"

rm -rf $BUILD_SCAN_DIR
done

echo "BUILD_SCANS=${BUILD_SCANS}" >> "$GITHUB_OUTPUT"
shell: bash

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- id: create-or-update-comment
name: Create or update comment
if: steps.get-pr-number.outputs.PR_NUMBER
working-directory: .github/actions
- name: Echo the current branch
run: |
npm ci
npm run comment-build-scan
git status
shell: bash
env:
BUILD_SCANS: ${{ steps.upload-build-scans.outputs.BUILD_SCANS }}
PR_NUMBER: ${{ steps.get-pr-number.outputs.PR_NUMBER }}