From d0133dc77a239dfc909626e7cad73881bf13312c Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Mon, 30 Sep 2019 02:56:40 +0200 Subject: [PATCH] actions: More GitHub actions (#1678) * actions: Rename stale action * actions: Use master branch of the action repos * actions: Use OpenOSRS as name * gradle: filter dependency updates * gradle: Add use-latest-versions plugin * actions: Update dependencies * actions: Combine actions * actions: Lint PR title * actions: gradle console plain * actions: Build and test with java matrix * actions: Rane some actions --- .github/workflows/auto-approve.yml | 14 ------ .github/workflows/build.yml | 71 +++++++++++++++++++++++++--- .github/workflows/checkstyle.yml | 19 -------- .github/workflows/gradle.yml | 42 ++++++++++++++++ .github/workflows/gradle_wrapper.yml | 25 ---------- .github/workflows/scraper.yml | 39 +++++++++++---- .github/workflows/stale.yml | 5 +- .github/workflows/test.yml | 19 -------- build.gradle | 24 +++++++++- 9 files changed, 161 insertions(+), 97 deletions(-) delete mode 100644 .github/workflows/auto-approve.yml delete mode 100644 .github/workflows/checkstyle.yml create mode 100644 .github/workflows/gradle.yml delete mode 100644 .github/workflows/gradle_wrapper.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml deleted file mode 100644 index b85578e594..0000000000 --- a/.github/workflows/auto-approve.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: RunelitePlus - Auto approve - -on: pull_request - -jobs: - approve: - - runs-on: ubuntu-latest - - steps: - - uses: hmarr/auto-approve-action@v2.0.0 - if: github.actor == 'github-actions[bot]' - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de841f14b6..a2309af56b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,19 +1,78 @@ -name: RunelitePlus - CI +name: OpenOSRS - CI on: [pull_request, push] jobs: - build: + pr-lint: + name: Title linter + runs-on: ubuntu-latest + + steps: + - name: PR title lint + if: github.event_name == 'pull_request' + uses: seferov/pr-lint-action@master + with: + title-regex: '^\w+: \w+' + build: + runs-on: windows-latest + strategy: + matrix: + java: [ 9, 11, 12 ] + name: Build (Java ${{ matrix.java }}) + + steps: + - uses: actions/checkout@master + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@master + with: + java-version: ${{ matrix.java }} + - name: Assembling + run: gradlew assemble --console=plain + - name: Building + run: gradlew build --stacktrace -x test -x checkstyleMain --console=plain + + test: + runs-on: windows-latest + strategy: + matrix: + java: [ 9, 11, 12 ] + name: Test (Java ${{ matrix.java }}) + + steps: + - uses: actions/checkout@master + - name: Set up JDK 11 + uses: actions/setup-java@master + with: + java-version: ${{ matrix.java }} + - name: Assembling + run: gradlew assemble --console=plain + - name: Testing + run: gradlew test --stacktrace --console=plain + + checkstyle: + name: Checkstyle runs-on: windows-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@master - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@master with: java-version: 11 - name: Assembling run: gradlew assemble --console=plain - - name: Building - run: gradlew build --stacktrace -x test -x checkstyleMain --console=plain \ No newline at end of file + - name: Checking code conventions + run: gradlew checkstyleMain --console=plain + + approve: + name: Approve + needs: [build, test, checkstyle] + runs-on: ubuntu-latest + + steps: + - name: Approve pull request + if: github.event_name == 'pull_request' && github.actor == 'OpenOSRS' + uses: hmarr/auto-approve-action@master + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml deleted file mode 100644 index 47663761fc..0000000000 --- a/.github/workflows/checkstyle.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: RunelitePlus - Code convention - -on: [pull_request, push] - -jobs: - checkstyle: - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Assembling - run: gradlew assemble --console=plain - - name: Checking code conventions - run: gradlew checkstyleMain --console=plain \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000000..003a9a2c73 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,42 @@ +name: OpenOSRS - Gradle Dependencies + +on: + schedule: + - cron: 0 0 * * * + +jobs: + update-wrapper: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Update Gradle Wrapper + run: ./gradlew wrapper --gradle-version $(curl -s https://api.github.com/repos/gradle/gradle/releases/latest | grep -Po '"name":.*?[^\\]",' | sed -r 's/[\"name:, ]+//g') --distribution-type all --console=plain + - name: Create Gradle wrapper update Pull Request + uses: peter-evans/create-pull-request@master + env: + GITHUB_TOKEN: ${{ secrets.OpenOSRS }} + PULL_REQUEST_BRANCH: GRADLE-WRAPPER-UPDATE + PULL_REQUEST_TITLE: 'project: Update gradle wrapper' + PULL_REQUEST_BODY: This is an auto-generated PR with an updated gradle version + COMMIT_MESSAGE: 'project: Update gradle wrapper' + + update-dependencies: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Update Gradle dependencies + run: ./gradlew useLatestVersions --console=plain + - name: Create Gradle dependencies update Pull Request + uses: peter-evans/create-pull-request@master + env: + GITHUB_TOKEN: ${{ secrets.OpenOSRS }} + PULL_REQUEST_BRANCH: GRADLE-DEPENDENCY-UPDATE + PULL_REQUEST_TITLE: 'project: Update gradle dependencies' + PULL_REQUEST_BODY: This is an auto-generated PR with an updated gradle dependencies versions + COMMIT_MESSAGE: 'project: Update gradle dependencies' diff --git a/.github/workflows/gradle_wrapper.yml b/.github/workflows/gradle_wrapper.yml deleted file mode 100644 index 13ded2bcd3..0000000000 --- a/.github/workflows/gradle_wrapper.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: RunelitePlus - Gradle Wrapper - -on: - schedule: - - cron: 0 0 * * * - -jobs: - update: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@master - - name: Make gradlew executable - run: chmod +x ./gradlew - - name: Update Gradle Wrapper - run: ./gradlew wrapper --gradle-version $(curl -s https://api.github.com/repos/gradle/gradle/releases/latest | grep -Po '"name":.*?[^\\]",' | sed -r 's/[\"name:, ]+//g') --distribution-type all - - name: Create Gradle wrapper update Pull Request - uses: peter-evans/create-pull-request@v1.2.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PULL_REQUEST_BRANCH: GRADLE-WRAPPER-UPDATE - PULL_REQUEST_TITLE: 'project: Update gradle wrapper' - PULL_REQUEST_BODY: This is an auto-generated PR with an updated gradle version - COMMIT_MESSAGE: 'project: Update gradle wrapper' diff --git a/.github/workflows/scraper.yml b/.github/workflows/scraper.yml index 1aabc781db..e77c8048d9 100644 --- a/.github/workflows/scraper.yml +++ b/.github/workflows/scraper.yml @@ -1,18 +1,17 @@ -name: RunelitePlus - Scraper +name: OpenOSRS - Scraper on: schedule: - cron: "0 0 * * 2,5" jobs: - scrape: - + scrape-npcs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@master - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@master with: java-version: 11 - name: Make gradlew executable @@ -30,19 +29,41 @@ jobs: - name: Scraping NPC stats run: ./gradlew :wiki-scraper:npcStatsScrape --console=plain - name: Create NPC stats Pull Request - uses: peter-evans/create-pull-request@v1.2.0 + uses: peter-evans/create-pull-request@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OpenOSRS }} PULL_REQUEST_BRANCH: NPC-UPDATE PULL_REQUEST_TITLE: 'Client: Update NPC stats' PULL_REQUEST_BODY: This is an auto-generated PR with changes from the OSRS wiki COMMIT_MESSAGE: 'Client: Update NPC stats' + + scrape-items: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Set up JDK 11 + uses: actions/setup-java@master + with: + java-version: 11 + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Assembling cache client + run: ./gradlew :cache-client:assemble --console=plain + - name: Assembling scraper + run: ./gradlew :wiki-scraper:assemble --console=plain + - name: Building cache client + run: ./gradlew :cache-client:build --console=plain + - name: Building scraper + run: ./gradlew :wiki-scraper:build --console=plain + - name: Downloading jagex cache + run: ./gradlew :cache-client:update --console=plain - name: Scraping item stats run: ./gradlew :wiki-scraper:npcStatsScrape --console=plain - name: Create item stats Pull Request - uses: peter-evans/create-pull-request@v1.2.0 + uses: peter-evans/create-pull-request@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OpenOSRS }} PULL_REQUEST_BRANCH: ITEM-STATS-UPDATE PULL_REQUEST_TITLE: 'Client: Update item stats' PULL_REQUEST_BODY: This is an auto-generated PR with changes from the OSRS wiki diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5137bbf010..91eb678d40 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,4 @@ -name: Mark stale issues and pull requests +name: OpenOSRS - Stale issues and PRs on: schedule: @@ -6,11 +6,10 @@ on: jobs: stale: - runs-on: ubuntu-latest steps: - - uses: actions/stale@v1 + - uses: actions/stale@master with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'Stale issue message' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index f6a8f9ddaf..0000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: RunelitePlus - Testing - -on: [pull_request, push] - -jobs: - test: - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Assembling - run: gradlew assemble --console=plain - - name: Testing - run: gradlew test --stacktrace --console=plain \ No newline at end of file diff --git a/build.gradle b/build.gradle index 150ffa2bdf..f02c82d723 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,9 @@ buildscript { plugins { id 'com.adarshr.test-logger' version '1.7.0' apply false - id "com.github.ben-manes.versions" version "0.22.0" apply false + id "com.github.ben-manes.versions" version "0.22.0" id "com.gradle.build-scan" version "2.4" + id 'se.patrikerdes.use-latest-versions' version '0.2.8' } apply plugin: 'application' @@ -109,7 +110,6 @@ subprojects { apply plugin: 'com.adarshr.test-logger' apply plugin: 'java-library' apply plugin: 'maven' - apply plugin: "com.github.ben-manes.versions" apply plugin: 'fernflower' sourceCompatibility = 1.8 @@ -171,3 +171,23 @@ run { classpath = childProjects.client.sourceSets.main.runtimeClasspath mainClassName = "net.runelite.client.RuneLite" } + +def isNonStable = { String version -> + def unstableKeyword = ['ALPHA', 'BETA', 'RC'].any { it -> version.toUpperCase().contains(it) } + + return unstableKeyword +} + +dependencyUpdates { + checkForGradleUpdate = false + + resolutionStrategy { + componentSelection { + all { + if (isNonStable(candidate.version)) { + reject() + } + } + } + } +}