Skip to content

Commit

Permalink
Merge pull request #2973 from Multiverse/generic-test
Browse files Browse the repository at this point in the history
feat: Generify test action
  • Loading branch information
dumptruckman committed Aug 25, 2023
2 parents e9f55e4 + 16ceaa4 commit 288474c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 28 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/generic.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Generic: Test'

on:
workflow_call:
inputs:
plugin_name:
description: 'Plugin name'
required: true
type: string

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Run unit tests
uses: gradle/gradle-build-action@v2
with:
arguments: build
env:
GITHUB_VERSION: pr${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Artifact output
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.plugin_name }}-pr${{ github.event.pull_request.number }}
path: build/libs/${{ inputs.plugin_name }}-pr${{ github.event.pull_request.number }}.jar
31 changes: 3 additions & 28 deletions .github/workflows/pr.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,6 @@ on:

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Run unit tests
uses: gradle/gradle-build-action@v2
with:
arguments: build
env:
GITHUB_VERSION: pr${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Artifact output
uses: actions/upload-artifact@v3
with:
name: multiverse-core-pr${{ github.event.pull_request.number }}
path: build/libs/multiverse-core-pr${{ github.event.pull_request.number }}.jar
uses: ./.github/workflows/generic.test.yml
with:
plugin_name: multiverse-core

0 comments on commit 288474c

Please sign in to comment.