mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-12-11 14:37:53 +01:00
115 lines
2.6 KiB
YAML
115 lines
2.6 KiB
YAML
|
name: Build
|
||
|
on: [push]
|
||
|
jobs:
|
||
|
build:
|
||
|
|
||
|
runs-on: ubuntu-18.04
|
||
|
# We want to run on external PRs, but not on our own internal PRs as they'll be run
|
||
|
# by the push to the branch.
|
||
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
||
|
|
||
|
|
||
|
steps:
|
||
|
- name: Set up JDK 11
|
||
|
uses: actions/setup-java@v1
|
||
|
with:
|
||
|
java-version: 11
|
||
|
|
||
|
- name: Cache Gradle
|
||
|
id: cache-gradle
|
||
|
uses: actions/cache@v1
|
||
|
with:
|
||
|
path: ~/.gradle
|
||
|
key: ${{ runner.os }}-gradle
|
||
|
|
||
|
- uses: actions/checkout@v1
|
||
|
|
||
|
- name: Grant execute permission to gradlew
|
||
|
run: chmod +x gradlew
|
||
|
|
||
|
- name: Build
|
||
|
run: ./gradlew build -x test
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
|
||
|
- name: Upload build artifacts
|
||
|
uses: actions/upload-artifact@v2
|
||
|
with:
|
||
|
path: "**/build/libs"
|
||
|
|
||
|
test:
|
||
|
|
||
|
runs-on: ubuntu-18.04
|
||
|
|
||
|
steps:
|
||
|
- name: Set up JDK 11
|
||
|
uses: actions/setup-java@v1
|
||
|
with:
|
||
|
java-version: 11
|
||
|
|
||
|
- name: Cache Gradle
|
||
|
id: cache-gradle
|
||
|
uses: actions/cache@v1
|
||
|
with:
|
||
|
path: ~/.gradle
|
||
|
key: ${{ runner.os }}-gradle
|
||
|
|
||
|
- uses: actions/checkout@v1
|
||
|
|
||
|
- name: Grant execute permission to gradlew
|
||
|
run: chmod +x gradlew
|
||
|
|
||
|
- name: Test
|
||
|
run: ./gradlew test
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
|
||
|
- name: Upload CodeCov Report
|
||
|
uses: codecov/codecov-action@v1
|
||
|
with:
|
||
|
file: "**/build/reports/jacoco/**/*.xml"
|
||
|
|
||
|
- name: Upload Test Report
|
||
|
uses: actions/upload-artifact@v2
|
||
|
if: always()
|
||
|
with:
|
||
|
name: build reports
|
||
|
path: "**/build/reports"
|
||
|
|
||
|
release:
|
||
|
needs: [build, test]
|
||
|
if: github.ref == 'refs/heads/master'
|
||
|
|
||
|
runs-on: ubuntu-18.04
|
||
|
|
||
|
steps:
|
||
|
- name: Set up JDK 8
|
||
|
uses: actions/setup-java@v1
|
||
|
with:
|
||
|
java-version: 8
|
||
|
|
||
|
- name: Set up Node.js v12.x
|
||
|
uses: actions/setup-node@v1
|
||
|
with:
|
||
|
node-version: "12.x"
|
||
|
|
||
|
- name: Cache Gradle
|
||
|
id: cache-gradle
|
||
|
uses: actions/cache@v1
|
||
|
with:
|
||
|
path: ~/.gradle
|
||
|
key: ${{ runner.os }}-gradle
|
||
|
|
||
|
- uses: actions/checkout@v1
|
||
|
|
||
|
- name: Grant execute permission for gradlew
|
||
|
run: chmod +x gradlew
|
||
|
|
||
|
- name: Release
|
||
|
run: |
|
||
|
yarn install
|
||
|
yarn semantic-release
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
GH_URL: "https://api.github.com/"
|