From 22bcfb0b6f57e1a19610f051e5b3bdbc81739fec Mon Sep 17 00:00:00 2001 From: Ikhun Um Date: Sat, 5 Jun 2021 17:22:57 +0900 Subject: [PATCH] Add a scheduled job that updates public suffix list periodically (#3590) Motivation: Public Suffix List is automatically updated when building projects. It should be inefficient to update the public_suffixes.txt on every PR. Additionally, the unexpectedly updated file makes contributors embarrassed. We've repeatedly explained why the file was changed to them. #3546 Modifications: - Remove `PublicSuffixesTask` dependency from build phases. - Add a GitHub Actions job that schedules to update the public suffix list every day. Result: - Improved build process and less noise in PR diffs - Fixes #3546 --- .gitattributes | 3 -- .github/workflows/public-suffixes.yml | 59 +++++++++++++++++++++++++++ core/build.gradle | 2 - 3 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/public-suffixes.yml diff --git a/.gitattributes b/.gitattributes index ccf0e97c342..486851be6ab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -34,6 +34,3 @@ *.woff2 binary *.xz binary *.zip binary - -# Collapse generated code in diffs -public_suffixes.txt linguist-generated diff --git a/.github/workflows/public-suffixes.yml b/.github/workflows/public-suffixes.yml new file mode 100644 index 00000000000..f50e6bab023 --- /dev/null +++ b/.github/workflows/public-suffixes.yml @@ -0,0 +1,59 @@ +name: Update Public Suffix List +on: + schedule: + - cron: '0 10 * * *' + +jobs: + update-psl: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - id: setup-jdk-15 + name: Set up JDK 15 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '15' + + - name: Restore Gradle Cache + uses: actions/cache@v2 + with: + path: | + ~/.gradle/wrapper/dists + ~/.gradle/caches/jars-3 + ~/.gradle/caches/modules-2 + ~/.gradle/caches/package-lists + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build with Gradle + run: | + ./gradlew --no-daemon --stacktrace :core:publicSuffixes + + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + git-user-signingkey: true + git-commit-gpgsign: true + + - name: Push updated public suffix list + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_options: '-S' + commit_message: Update public suffix list + file_pattern: core/src/main/resources/com/linecorp/armeria/public_suffixes.txt + commit_user_name: Meri Kim + commit_user_email: dl_armeria@linecorp.com + commit_author: Meri Kim + + - name: Cleanup Gradle Cache + # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. + # Restoring these files from a GitHub Actions cache might cause problems for future builds. + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock || true + rm -f ~/.gradle/caches/modules-2/gc.properties || true + shell: bash diff --git a/core/build.gradle b/core/build.gradle index a6243b856b6..51c4dc2fc0e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -240,5 +240,3 @@ class PublicSuffixesTask extends DefaultTask { } task publicSuffixes(type: PublicSuffixesTask) -tasks.processResources.dependsOn publicSuffixes -tasks.classes.dependsOn publicSuffixes