Skip to content

Commit

Permalink
Merge branch 'main' into add-web-test-client
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhee17 committed Mar 26, 2024
2 parents 680a9a9 + b14f934 commit b97719a
Show file tree
Hide file tree
Showing 563 changed files with 37,637 additions and 12,615 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{kt,kts}]
max_line_length = 112
2 changes: 0 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# https://help.github.com/articles/about-codeowners/

* @ikhoon @jrhee17 @minwoox @trustin
34 changes: 34 additions & 0 deletions .github/check-workflow-write-permission.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail

# This script checks if the current user is allowed to change to GitHub Actions workflows. The script should be
# installed on self-hosted runners and defined in the `ACTIONS_RUNNER_HOOK_JOB_STARTED` environment variable.
# The script is triggered when a job has been assigned to a runner, but before the job starts running.
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/running-scripts-before-or-after-a-job#triggering-the-scripts

if [[ $GITHUB_REF != refs/pull* ]]; then
echo "Not a pull request. Skipping"
exit 0
fi

PR_NUMBER=$(echo "$GITHUB_REF" | awk -F / '{print $3}')
# To obtain sufficient quota for gh cli, it is recommended to set PAT in the `GH_TOKEN` environment variable.
# Check if there are any changes in .github/actions or .github/workflows
WORKFLOW_CHANGES=$(gh -R github.com/line/armeria pr diff "$PR_NUMBER" --name-only | grep -c '^.github/workflows\|^.github/actions' || true)
if [[ "$WORKFLOW_CHANGES" -eq "0" ]]; then
echo "No changes in .github/actions or .github/workflows. Skipping."
exit 0
fi

# dependabot[bot] is a special user that is used to update dependencies in the workflow files.
MAINTAINERS=("ikhoon" "dependabot[bot]" "jrhee17" "minwoox" "trustin")
for maintainer in "${MAINTAINERS[@]}"
do
if [[ $maintainer == "$GITHUB_ACTOR" ]]; then
echo "@$GITHUB_ACTOR is a maintainer. Allowed to change GitHub Actions workflows."
exit 0
fi
done

echo "@$GITHUB_ACTOR is not a maintainer. Disallowed to change GitHub Actions workflows."
exit 1
8 changes: 8 additions & 0 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
components:
/:
- ikhoon
- jrhee17
- minwoox
- trustin
brave/:
- codefromthecrypt
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ updates:
time: "10:00"
# Use Korea Standard Time (UTC +09:00)
timezone: "Asia/Seoul"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
versioning-strategy: increase
66 changes: 44 additions & 22 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,47 @@ env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

jobs:
choose-self-hosted:
runs-on: ubuntu-latest
outputs:
runner: ${{ steps.runner.outputs.runner }}

steps:
- id: runner
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "runner=self-hosted-unsafe" >> "$GITHUB_OUTPUT"
else
echo "runner=self-hosted-safe" >> "$GITHUB_OUTPUT"
fi
build:
needs: [ choose-self-hosted ]
if: github.repository == 'line/armeria'
runs-on: ${{ matrix.on }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
on: [ self-hosted, macos-12, windows-latest ]
on: [ "${{ needs.choose-self-hosted.outputs.runner }}", macos-12, windows-latest ]
java: [ 19 ]
include:
- java: 8
on: self-hosted
on: ${{ needs.choose-self-hosted.outputs.runner }}
- java: 11
on: self-hosted
on: ${{ needs.choose-self-hosted.outputs.runner }}
- java: 17
on: self-hosted
on: ${{ needs.choose-self-hosted.outputs.runner }}
leak: true
- java: 17
on: self-hosted
on: ${{ needs.choose-self-hosted.outputs.runner }}
min-java: 11
- java: 17
on: self-hosted
on: ${{ needs.choose-self-hosted.outputs.runner }}
min-java: 17
coverage: true
- java: 19
on: self-hosted
on: ${{ needs.choose-self-hosted.outputs.runner }}
snapshot: true
# blockhound makes the build run about 10 minutes slower
blockhound: true
Expand All @@ -69,27 +84,34 @@ jobs:
- id: setup-jdk
if: ${{ matrix.java != env.BUILD_JDK_VERSION }}
name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
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
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}

- name: Clean up stale build scan data
if: always()
run: |
rm -rf ~/.gradle/build-scan-data/*
rm -rf ~/.gradle/init.d
shell: bash

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

# 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 \
${{ startsWith(matrix.on, 'self-hosted') && '--max-workers=8' || '--max-workers=2' }} --parallel \
${{ matrix.coverage && '-Pcoverage' || '' }} \
-PnoLint \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
Expand All @@ -108,7 +130,7 @@ jobs:
- name: Build with Gradle
run: |
./gradlew --no-daemon --stacktrace build \
${{ (matrix.on == 'self-hosted') && '--max-workers=8' || '--max-workers=2' }} --parallel \
${{ startsWith(matrix.on, 'self-hosted') && '--max-workers=8' || '--max-workers=2' }} --parallel \
${{ matrix.coverage && '-Pcoverage' || '' }} \
${{ matrix.leak && '-Pleak' || '' }} \
${{ matrix.blockhound && '-Pblockhound' || '' }} \
Expand All @@ -125,7 +147,7 @@ jobs:

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

- name: Upload the artifacts
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
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
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4

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

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

- name: Run the linters
run: |
Expand All @@ -245,13 +267,13 @@ jobs:
- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}

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

- name: Build the site
run: |
Expand All @@ -260,20 +282,20 @@ jobs:

flaky-tests:
if: github.repository == 'line/armeria'
runs-on: self-hosted
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4

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

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

- name: Run flaky tests
run: |
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/component-owners-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Component Owners'
on:
# pull_request_target is suggested for projects where pull requests will be
# made from forked repositories. If pull_request is used in these cases,
# the github token will not have sufficient permission to update the PR.
pull_request_target:

permissions:
contents: read # to read changed files
issues: write # to read/write issue assignees
pull-requests: write # to read/write PR reviewers

jobs:
run_self:
runs-on: ubuntu-latest
name: Auto Assign Owners
steps:
- uses: dyladan/component-owners@main
with:
config-file: .github/component_owners.yml
repo-token: ${{ github.token }}
assign-owners: "false"
request-owner-reviews: "true"
76 changes: 76 additions & 0 deletions .github/workflows/e2e-chaos-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: E2E Tests

on:
push:
branches:
- main
tags-ignore:
# The release versions will be verified by 'publish-release.yml'
- armeria-*
pull_request:

concurrency:
group: ci-e2e-chaos-tests-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
CHAOS_MESH_VERSION: 2.6.2
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

jobs:
chaos-tests:
name: Kubernetes Chaos test
runs-on: ubuntu-latest
timeout-minutes: 120
if: github.repository == 'line/armeria'
steps:
- uses: actions/checkout@v4

- id: setup-jdk-19
name: Setup Java 19
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 19

- name: Setup Minikube
id: minikube
uses: medyagh/setup-minikube@latest

- name: Install Chaos Mesh
run: |
curl -sSL https://mirrors.chaos-mesh.org/v${CHAOS_MESH_VERSION}/install.sh | bash
kubectl wait --for=condition=Ready pods --all-namespaces --all --timeout=600s
shell: bash

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

- name: Build Chaos test images
run: |
# The images should be built in the minikube docker environment
eval $(minikube -p minikube docker-env)
./gradlew --no-daemon --stacktrace :it:kubernetes-chaos-tests:k8sBuild
shell: bash

- name: Run Chaos Tests - network-delay.yaml
env:
CHAOS_TEST: network-delay.yaml
run: |
./gradlew --no-daemon --stacktrace :it:kubernetes-chaos-tests:test
shell: bash

- name: Run Chaos Tests - network-loss.yaml
env:
CHAOS_TEST: network-loss.yaml
run: |
# --rerun-tasks is required to run the tests because only the environment variable is changed
./gradlew --no-daemon --stacktrace :it:kubernetes-chaos-tests:test --rerun-tasks
shell: bash

- name: Run Chaos Tests - network-duplicate.yaml
env:
CHAOS_TEST: network-duplicate.yaml
run: |
./gradlew --no-daemon --stacktrace :it:kubernetes-chaos-tests:test --rerun-tasks
shell: bash

0 comments on commit b97719a

Please sign in to comment.