Skip to content

Commit

Permalink
split jobs in github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
gciatto committed Oct 25, 2020
1 parent 3f2e6ab commit 2562168
Showing 1 changed file with 259 additions and 12 deletions.
271 changes: 259 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
env:
jdk-version: openjdk@~1.15.0
project-name: 2P-Kt
gradle-options: "--no-daemon --console=plain"
gradle-options: "--no-daemon --console=plain --stacktrace"
jobs:
setup:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -89,12 +89,86 @@ jobs:
- name: Compile
run: gradle ${{ env.gradle-options }} assemble --parallel

# - name: Test JVM
# run: gradle ${{ env.gradle-options }} jvmTest
#
# - name: Archive JVM Test Reports
# uses: actions/upload-artifact@v2
# if: failure()
# with:
# name: jvm-test-reports
# path: '**/build/reports/tests/jvmTest'
#
# - name: Test JS
# run: gradle ${{ env.gradle-options }} jsTest
#
# - name: Archive JS Test Reports
# if: failure()
# uses: actions/upload-artifact@v2
# with:
# name: js-test-reports
# path: '**/build/reports/tests/jsTest'
#
# - name: Generate Doc
# run: gradle ${{ env.gradle-options }} dokkaHtml --parallel
#
# - name: Generate Molti-Module Doc
# run: gradle ${{ env.gradle-options }} dokkaHtmlMultiModule --parallel
#
# - name: Archive Doc
# uses: actions/upload-artifact@v2
# with:
# name: api-references
# path: build/dokka/htmlMultiModule

test:
runs-on: ubuntu-latest
needs:
- build
steps:
# - *checkout_code
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # all history

# - *cache_jdk
- name: Cache JDK
uses: actions/cache@v2
with:
path: ~/.jabba
key: ${{ runner.os }}-jdk-${{ env.jdk-version }}
restore-keys: |
${{ runner.os }}-jdk-
${{ runner.os }}-
# - *install_jdk
- uses: battila7/jdk-via-jabba@v1
name: Restore JDK
with:
jdk: ${{ env.jdk-version }}

# - *cache_gradle
- name: Cache Gradle Data
uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.gradle/caches
~/gradle/wrapper
**/build
**/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
${{ runner.os }}-
- name: Test JVM
run: gradle ${{ env.gradle-options }} jvmTest

- name: Archive JVM Test Reports
uses: actions/upload-artifact@v2
if: failure()
if: failure() || success()
with:
name: jvm-test-reports
path: '**/build/reports/tests/jvmTest'
Expand All @@ -103,12 +177,54 @@ jobs:
run: gradle ${{ env.gradle-options }} jsTest

- name: Archive JS Test Reports
if: failure()
if: failure() || success()
uses: actions/upload-artifact@v2
with:
name: js-test-reports
path: '**/build/reports/tests/jsTest'

prepare-artifacts:
runs-on: ubuntu-latest
needs:
- test
steps:
# - *checkout_code
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # all history

# - *cache_jdk
- name: Cache JDK
uses: actions/cache@v2
with:
path: ~/.jabba
key: ${{ runner.os }}-jdk-${{ env.jdk-version }}
restore-keys: |
${{ runner.os }}-jdk-
${{ runner.os }}-
# - *install_jdk
- uses: battila7/jdk-via-jabba@v1
name: Restore JDK
with:
jdk: ${{ env.jdk-version }}

# - *cache_gradle
- name: Cache Gradle Data
uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.gradle/caches
~/gradle/wrapper
**/build
**/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
${{ runner.os }}-
- name: Generate Doc
run: gradle ${{ env.gradle-options }} dokkaHtml --parallel

Expand All @@ -121,10 +237,13 @@ jobs:
name: api-references
path: build/dokka/htmlMultiModule

deploy-maven:
- name: Sign Archives
run: gradle ${{ env.gradle-options }} signAllPublications --parallel

deploy-maven-github:
runs-on: ubuntu-latest
needs:
- build
- prepare-artifacts
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
Expand Down Expand Up @@ -165,9 +284,6 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
${{ runner.os }}-
- name: Sign Archives
run: gradle ${{ env.gradle-options }} signAllPublications --parallel
- name: Publish on GitHub Maven Repo
run: gradle ${{ env.gradle-options }} publishAllPublicationsToMavenRepository --parallel
Expand All @@ -176,23 +292,154 @@ jobs:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ github.actor }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.GITHUB_TOKEN }}

# - name: Publish on Bintray Maven Repo
# run: gradle ${{ env.gradle-options }} publishAllToBintray --parallel
# env:
# ORG_GRADLE_PROJECT_bintrayUser: ${{ secrets.BINTRAY_USER }}
# ORG_GRADLE_PROJECT_bintrayKey: ${{ secrets.BINTRAY_USER }}
#
# - name: Publish on Maven Central Repo
# run: gradle ${{ env.gradle-options }} publishAllToBintray --parallel
# if: contains(github.ref, 'master')
# env:
# ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
# ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}

deploy-maven:
runs-on: ubuntu-latest
needs:
- prepare-artifacts
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
steps:
# - *checkout_code
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # all history

# - *cache_jdk
- name: Cache JDK
uses: actions/cache@v2
with:
path: ~/.jabba
key: ${{ runner.os }}-jdk-${{ env.jdk-version }}
restore-keys: |
${{ runner.os }}-jdk-
${{ runner.os }}-
# - *install_jdk
- uses: battila7/jdk-via-jabba@v1
name: Restore JDK
with:
jdk: ${{ env.jdk-version }}

# - *cache_gradle
- name: Cache Gradle Data
uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.gradle/caches
~/gradle/wrapper
**/build
**/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
${{ runner.os }}-
# - name: Publish on GitHub Maven Repo
# run: gradle ${{ env.gradle-options }} publishAllPublicationsToMavenRepository --parallel
# env:
# ORG_GRADLE_PROJECT_sonatypeUrl: https://maven.pkg.github.com/${{ github.repository }}
# ORG_GRADLE_PROJECT_ossrhUsername: ${{ github.actor }}
# ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.GITHUB_TOKEN }}

- name: Publish on Bintray Maven Repo
run: gradle ${{ env.gradle-options }} publishAllToBintray --parallel
env:
ORG_GRADLE_PROJECT_bintrayUser: ${{ secrets.BINTRAY_USER }}
ORG_GRADLE_PROJECT_bintrayKey: ${{ secrets.BINTRAY_USER }}

# - name: Publish on Maven Central Repo
# run: gradle ${{ env.gradle-options }} publishAllToBintray --parallel
# if: contains(github.ref, 'master')
# env:
# ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
# ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}

deploy-maven-central:
runs-on: ubuntu-latest
if: contains(github.ref, 'master')
needs:
- prepare-artifacts
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
steps:
# - *checkout_code
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # all history

# - *cache_jdk
- name: Cache JDK
uses: actions/cache@v2
with:
path: ~/.jabba
key: ${{ runner.os }}-jdk-${{ env.jdk-version }}
restore-keys: |
${{ runner.os }}-jdk-
${{ runner.os }}-
# - *install_jdk
- uses: battila7/jdk-via-jabba@v1
name: Restore JDK
with:
jdk: ${{ env.jdk-version }}

# - *cache_gradle
- name: Cache Gradle Data
uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.gradle/caches
~/gradle/wrapper
**/build
**/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
${{ runner.os }}-
# - name: Publish on GitHub Maven Repo
# run: gradle ${{ env.gradle-options }} publishAllPublicationsToMavenRepository --parallel
# env:
# ORG_GRADLE_PROJECT_sonatypeUrl: https://maven.pkg.github.com/${{ github.repository }}
# ORG_GRADLE_PROJECT_ossrhUsername: ${{ github.actor }}
# ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Publish on Bintray Maven Repo
# run: gradle ${{ env.gradle-options }} publishAllToBintray --parallel
# env:
# ORG_GRADLE_PROJECT_bintrayUser: ${{ secrets.BINTRAY_USER }}
# ORG_GRADLE_PROJECT_bintrayKey: ${{ secrets.BINTRAY_USER }}

- name: Publish on Maven Central Repo
run: gradle ${{ env.gradle-options }} publishAllToBintray --parallel
if: contains(github.ref, 'master')
# if: contains(github.ref, 'master')
env:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}

deploy-npm:
runs-on: ubuntu-latest
needs:
- build
- test
steps:
# - *checkout_code
- name: Checkout code
Expand Down Expand Up @@ -233,14 +480,14 @@ jobs:
- name: Publish on NPM
run: |
gradle ${{ env.gradle-options }} --stacktrace clean jsMain npmPublish
gradle ${{ env.gradle-options }} clean jsMain npmPublish
env:
ORG_GRADLE_PROJECT_npmToken: ${{ secrets.NPM_TOKEN }}

deploy-github:
runs-on: ubuntu-latest
needs:
- build
- prepare-artifacts
steps:
# - *checkout_code
- name: Checkout code
Expand Down

0 comments on commit 2562168

Please sign in to comment.