Skip to content

Commit

Permalink
Optimize CI a bit (#2385)
Browse files Browse the repository at this point in the history
* Bump actions/checkout to v3

* Bump actions/setup-java to v3

* Use gradle-build-action

* Merge validation into check.yml

* Reformat

* Trim blank lines

* Use https

* Cleanup

* Fix

* Remove names

* Cleanup

* Rename validate to validate-wrapper

* Use cirrus-actions/[email protected]

* Use cirrus-actions/[email protected]
  • Loading branch information
Goooler authored Mar 24, 2022
1 parent dd0fd03 commit ea4a3bf
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 114 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/apiCheck.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check

on: pull_request

jobs:
validate-wrapper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1

apiCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- uses: gradle/gradle-build-action@v2
with:
arguments: apiCheck --stacktrace
48 changes: 26 additions & 22 deletions .github/workflows/dokka-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ jobs:
strategy:
matrix:
projects: [
examples/gradle/dokka-gradle-example,
examples/gradle/dokka-kotlinAsJava-example,
examples/gradle/dokka-library-publishing-example,
examples/gradle/dokka-multimodule-example,
examples/gradle/dokka-multiplatform-example,
examples/gradle/dokka-customFormat-example
examples/gradle/dokka-gradle-example,
examples/gradle/dokka-kotlinAsJava-example,
examples/gradle/dokka-library-publishing-example,
examples/gradle/dokka-multimodule-example,
examples/gradle/dokka-multiplatform-example,
examples/gradle/dokka-customFormat-example
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
examples_changed:
- '${{ matrix.projects }}/**'
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- uses: gradle/gradle-build-action@v2
- run: ./gradlew build --no-daemon --stacktrace
working-directory: ${{ matrix.projects }}
if: steps.filter.outputs.examples_changed == 'true'
Expand All @@ -35,46 +36,48 @@ jobs:
strategy:
matrix:
projects: [
examples/gradle/dokka-gradle-example,
examples/gradle/dokka-kotlinAsJava-example,
examples/gradle/dokka-library-publishing-example,
examples/gradle/dokka-multiplatform-example,
examples/gradle/dokka-customFormat-example
examples/gradle/dokka-gradle-example,
examples/gradle/dokka-kotlinAsJava-example,
examples/gradle/dokka-library-publishing-example,
examples/gradle/dokka-multiplatform-example,
examples/gradle/dokka-customFormat-example
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
examples_changed:
- '${{ matrix.projects }}/**'
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- uses: gradle/gradle-build-action@v2
- run: ./gradlew dokkaHtml --no-daemon --stacktrace
working-directory: ${{ matrix.projects }}
if: steps.filter.outputs.examples_changed == 'true'

run-dokka-publishing:
strategy:
matrix:
tasks: [dokkaJavadocJar, dokkaHtmlJar]
tasks: [ dokkaJavadocJar, dokkaHtmlJar ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
examples_changed:
- 'examples/gradle/dokka-library-publishing-example/**'
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- uses: gradle/gradle-build-action@v2
- run: ./gradlew ${{ matrix.tasks }} --no-daemon --stacktrace
working-directory: examples/gradle/dokka-library-publishing-example
if: steps.filter.outputs.examples_changed == 'true'
Expand All @@ -89,33 +92,34 @@ jobs:
- task: "dokkaHtmlMultiModule"
dir: "examples/gradle/dokka-multimodule-example"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
examples_changed:
- '${{ matrix.dir }}/**'
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- uses: gradle/gradle-build-action@v2
- run: ./gradlew ${{ matrix.task }} --no-daemon --stacktrace
working-directory: ${{ matrix.dir }}
if: steps.filter.outputs.examples_changed == 'true'

run-dokka-maven-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
examples_changed:
- 'examples/maven/**'
working-directory: examples/maven
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
Expand Down
35 changes: 14 additions & 21 deletions .github/workflows/gh-pages-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,37 @@ on:
push:
branches:
- master

jobs:
build-examples:
runs-on: ubuntu-latest
if: github.repository == 'Kotlin/dokka'
strategy:
matrix:
projects: [
dokka-gradle-example,
dokka-kotlinAsJava-example,
dokka-library-publishing-example,
dokka-multiplatform-example,
dokka-customFormat-example
dokka-gradle-example,
dokka-kotlinAsJava-example,
dokka-library-publishing-example,
dokka-multiplatform-example,
dokka-customFormat-example
]
steps:
- name: Checkout dokka
uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
examples_changed:
- 'examples/gradle/${{ matrix.projects }}/**'
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

- uses: gradle/gradle-build-action@v2
- name: Build html
run: ./gradlew dokkaHtml --no-daemon --stacktrace
working-directory: examples/gradle/${{ matrix.projects }}
if: steps.filter.outputs.examples_changed == 'true'

- name: Upload artifact
uses: actions/upload-artifact@v2
if: steps.filter.outputs.examples_changed == 'true'
Expand All @@ -49,29 +47,24 @@ jobs:
if: github.repository == 'Kotlin/dokka'
strategy:
matrix:
projects: [
dokka-versioning-multimodule-example
]
projects: [ dokka-versioning-multimodule-example ]
steps:
- name: Checkout dokka
uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
examples_changed:
- 'examples/gradle/${{ matrix.projects }}/**'
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

- uses: gradle/gradle-build-action@v2
- name: Build html
run: ./gradlew dokkaHtmlMultiModule --no-daemon --stacktrace
working-directory: examples/gradle/${{ matrix.projects }}
if: steps.filter.outputs.examples_changed == 'true'

- name: Upload artifact
uses: actions/upload-artifact@v2
if: steps.filter.outputs.examples_changed == 'true'
Expand All @@ -81,7 +74,7 @@ jobs:

deploy-examples:
runs-on: ubuntu-latest
needs: [build-examples, build-multimodule-examples]
needs: [ build-examples, build-multimodule-examples ]
steps:
- uses: actions/download-artifact@v2
with:
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,36 @@ on:
branches:
- master
release:
types: [published]
types: [ published ]

jobs:
docs:
if: github.repository == 'Kotlin/dokka'
runs-on: ubuntu-latest
steps:
- name: Checkout dokka
uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: dokka

- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
docs_changed:
- 'docs/**'
working-directory: ./dokka

- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

- uses: gradle/gradle-build-action@v2
- name: Get current dokka version
run: echo "DOKKA_VERSION=`./gradlew :properties | grep '^version:.*' | cut -d ' ' -f 2 | cut -d '-' -f 1`" >> $GITHUB_ENV
if: github.event_name == 'release' || steps.filter.outputs.docs_changed == 'true'
working-directory: ./dokka

- name: Build docs
run: ./gradlew mkdocsBuild -Pdokka_version=$DOKKA_VERSION --info
if: github.event_name == 'release' || steps.filter.outputs.docs_changed == 'true'
working-directory: ./dokka

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'release' || steps.filter.outputs.docs_changed == 'true'
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/gradle-test.pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Test

on: pull_request

Expand All @@ -9,12 +9,14 @@ jobs:
version: [ 8, 11, 17 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.version }}
- run: ./gradlew clean test --stacktrace
- uses: gradle/gradle-build-action@v2
with:
arguments: clean test --stacktrace

test-windows:
strategy:
Expand All @@ -23,9 +25,11 @@ jobs:
fail-fast: false
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.version }}
- run: ./gradlew clean test --stacktrace --no-daemon --parallel --max-workers=1
- uses: gradle/gradle-build-action@v2
with:
arguments: clean test --stacktrace --no-daemon --parallel --max-workers=1
8 changes: 5 additions & 3 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Automatic Rebase

on:
issue_comment:
types: [created]
name: Automatic Rebase
types: [ created ]

jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Automatic Rebase
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/s3-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1

- name: Delete branch from s3
run: aws s3 --recursive rm s3://${{ env.bucket-name }}/${{ github.event.ref }}
Loading

0 comments on commit ea4a3bf

Please sign in to comment.