Share
Embed
Devops-ify your life with Github Actions
What's the first thing you should do when starting a new project...? Setup a good CI system!
With Github Actions you can do it in a couple of seconds. You can easily setup a workflow to build your project, test it on different machines, and deploy the results.
In this talk we're going to see how you can setup a simple Github Action for your repository and start enjoying it right after.
Nicola Corti
August 09, 2020
Transcript
77 slides
-
build-workflow.yml release-workflow.yml cleanup-workflow.yml Pull-request Push Comment Schedule Gradle Gradle Upload
to Bintray Upload to Sonatype Lock Issue -
name: Build on: push: branches: - '*' pull_request: branches: -
'*' jobs: gradle: -
name: Build on: push: branches: - '*' pull_request: branches: -
'*' jobs: gradle: runs-on: [ubuntu-latest] -
name: Build on: push: branches: - '*' pull_request: branches: -
'*' jobs: gradle: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 -
name: Build on: push: branches: - '*' pull_request: branches: -
'*' jobs: gradle: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Build everything run: ./gradlew assemble -
name: Build on: push: branches: - '*' pull_request: branches: -
'*' jobs: gradle: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Build everything run: ./gradlew assemble -
name: Build on: push: branches: - '*' pull_request: branches: -
'*' jobs: gradle: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Build everything run: ./gradlew assemble -
jobs: gradle: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Run ktlint run: ./gradlew ktlintCheck - name: Run detekt run: ./gradlew detekt - name: Run all the tests run: ./gradlew test github.com/AppIntro/AppIntro -
jobs: gradle: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Run ktlint run: ./gradlew ktlintCheck - name: Run detekt run: ./gradlew detekt - name: Run all the tests run: ./gradlew test github.com/AppIntro/AppIntro -
jobs: ktlint: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Run ktlint run: ./gradlew ktlintCheck detekt: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Run detekt run: ./gradlew detekt tests: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Run all the tests run: ./gradlew test github.com/AppIntro/AppIntro -
jobs: ktlint: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Run ktlint run: ./gradlew ktlintCheck detekt: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Run detekt run: ./gradlew detekt tests: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Run all the tests run: ./gradlew test github.com/AppIntro/AppIntro -
jobs: ktlint: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Run ktlint run: ./gradlew ktlintCheck detekt: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Run detekt run: ./gradlew detekt test: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Run all the tests run: ./gradlew test github.com/AppIntro/AppIntro -
jobs: build-debug-apk: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Build the Debug APK run: ./gradlew assembleDebug - uses: actions/upload-artifact@v2 with: name: appintro-sample-app.apk path: example/build/outputs/apk/debug/example-debug.apk github.com/AppIntro/AppIntro -
jobs: build-debug-apk: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Build the Debug APK run: ./gradlew assembleDebug - uses: actions/upload-artifact@v2 with: name: appintro-sample-app.apk path: example/build/outputs/apk/debug/example-debug.apk github.com/AppIntro/AppIntro -
jobs: build-debug-apk: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses:
actions/checkout@v2 - name: Build the Debug APK run: ./gradlew assembleDebug - uses: actions/upload-artifact@v2 with: name: appintro-sample-app.apk path: example/build/outputs/apk/debug/example-debug.apk github.com/AppIntro/AppIntro -
github.com/detekt/detekt/ jobs: gradle: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy:
fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] jdk: [8, 11, 14] runs-on: ${{ matrix.os }} -
github.com/detekt/detekt/ jobs: gradle: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy:
fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] jdk: [8, 11, 14] runs-on: ${{ matrix.os }} -
github.com/detekt/detekt/ jobs: gradle: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy:
fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] jdk: [8, 11, 14] runs-on: ${{ matrix.os }} env: GRADLE_OPTS: -Dorg.gradle.daemon=false JDK_VERSION: ${{ matrix.jdk }} steps: - name: Checkout Repo uses: actions/checkout@v2 -
github.com/detekt/detekt/ jobs: gradle: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy:
fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] jdk: [8, 11, 14] runs-on: ${{ matrix.os }} env: GRADLE_OPTS: -Dorg.gradle.daemon=false JDK_VERSION: ${{ matrix.jdk }} steps: - name: Checkout Repo uses: actions/checkout@v2 -
github.com/detekt/detekt/ jobs: gradle: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy:
fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] jdk: [8, 11, 14] runs-on: ${{ matrix.os }} env: GRADLE_OPTS: -Dorg.gradle.daemon=false JDK_VERSION: ${{ matrix.jdk }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Setup Java uses: actions/setup-java@v1 with: java-version: ${{ matrix.jdk }} -
github.com/detekt/detekt/ jobs: gradle: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy:
fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] jdk: [8, 11, 14] runs-on: ${{ matrix.os }} env: GRADLE_OPTS: -Dorg.gradle.daemon=false JDK_VERSION: ${{ matrix.jdk }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Setup Java uses: actions/setup-java@v1 with: java-version: ${{ matrix.jdk }} -
name: Release to Play Store on: push: branches: - release
jobs: gradle: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build with Gradle run: ./gradlew bundleRelease -
branches: - release jobs: gradle: runs-on: ubuntu-latest steps: - uses:
actions/checkout@v2 - name: Build with Gradle run: ./gradlew bundleRelease - name: Sign Android release uses: r0adkll/sign-android-release@v1 with: # The directory to find your release to sign releaseDirectory: app/build/outputs/bundle/release signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} -
branches: - release jobs: gradle: runs-on: ubuntu-latest steps: - uses:
actions/checkout@v2 - name: Build with Gradle run: ./gradlew bundleRelease - name: Sign Android release uses: r0adkll/sign-android-release@v1 with: # The directory to find your release to sign releaseDirectory: app/build/outputs/bundle/release signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} -
run: ./gradlew bundleRelease - name: Sign Android release uses: r0adkll/sign-android-release@v1
with: # The directory to find your release to sign releaseDirectory: app/build/outputs/bundle/release signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} - name: Upload Android Release to Play Store uses: r0adkll/[email protected] with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: it.gdgdevparty.sample releaseFile: app/build/outputs/bundle/release/app-release.aab track: beta -
name: Release to Play Store on: push: branches: - release
jobs: gradle: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build with Gradle run: ./gradlew bundleRelease - name: Sign Android release uses: r0adkll/sign-android-release@v1 with: # The directory to find your release to sign releaseDirectory: app/build/outputs/bundle/release signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} - name: Upload Android Release to Play Store uses: r0adkll/[email protected] with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: it.gdgdevparty.sample releaseFile: app/build/outputs/bundle/release/app-release.aab track: beta -
github.com/ChuckerTeam/chucker jobs: detekt: runs-on: [ubuntu-latest] steps: - name: Checkout Repo
uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ hashFiles('build.gradle') }} restore-keys: cache-gradle- - name: Run detekt run: ./gradlew detekt - name: Stop Gradle run: ./gradlew #--stop -
github.com/ChuckerTeam/chucker jobs: detekt: runs-on: [ubuntu-latest] steps: - name: Checkout Repo
uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ hashFiles('build.gradle') }} restore-keys: cache-gradle- - name: Run detekt run: ./gradlew detekt - name: Stop Gradle run: ./gradlew #--stop -
github.com/ChuckerTeam/chucker jobs: test: runs-on: [ubuntu-latest] strategy: fail-fast: false matrix: kotlin-version:
- 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{ matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle run: ./gradlew --stop -
github.com/ChuckerTeam/chucker jobs: test: runs-on: [ubuntu-latest] strategy: fail-fast: false matrix: kotlin-version:
- 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{ matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle run: ./gradlew --stop -
github.com/ChuckerTeam/chucker jobs: test: runs-on: [ubuntu-latest] strategy: fail-fast: false matrix: kotlin-version:
- 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{ matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle run: ./gradlew --stop -
github.com/ChuckerTeam/chucker matrix: kotlin-version: - 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{
matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle -
github.com/ChuckerTeam/chucker matrix: kotlin-version: - 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{
matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle cache-gradle-1.3.72-ddea0750 -
github.com/ChuckerTeam/chucker matrix: kotlin-version: - 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{
matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle cache-gradle-1.3.72-ddea0750 cache-gradle-1.4-M3-ddea0750 cache-gradle-1.3.72-feb253ff cache-gradle-1.4-M3-feb253ff Cache cache-gradle-1.3.72-ddea0750 -
github.com/ChuckerTeam/chucker matrix: kotlin-version: - 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{
matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle cache-gradle-1.3.72-ddea0750 cache-gradle-1.4-M3-ddea0750 cache-gradle-1.3.72-feb253ff cache-gradle-1.4-M3-feb253ff Cache cache-gradle-1.3.72-017fd2 -
github.com/ChuckerTeam/chucker matrix: kotlin-version: - 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{
matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle cache-gradle-1.3.72-ddea0750 cache-gradle-1.4-M3-ddea0750 cache-gradle-1.3.72-feb253ff cache-gradle-1.4-M3-feb253ff Cache cache-gradle-1.3.72-017fd2 -
github.com/ChuckerTeam/chucker matrix: kotlin-version: - 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{
matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle cache-gradle-1.3.72-ddea0750 cache-gradle-1.4-M3-ddea0750 cache-gradle-1.3.72-feb253ff cache-gradle-1.4-M3-feb253ff Cache cache-gradle-1.4.0-017fd2 -
github.com/ChuckerTeam/chucker matrix: kotlin-version: - 1.3.72 - 1.4-M3 env: KOTLIN_VERSION: ${{
matrix.kotlin-version }} steps: - name: Checkout Repo uses: actions/checkout@v2 - name: Cache Gradle Folders uses: actions/cache@v2 with: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ key: cache-gradle-${{ matrix.kotlin-version }}-${{ hashFiles('build.gradle') }} restore-keys: | cache-gradle-${{ matrix.version }}- cache-gradle- - name: Run all the tests run: ./gradlew test - name: Stop Gradle cache-gradle-1.3.72-ddea0750 cache-gradle-1.4-M3-ddea0750 cache-gradle-1.3.72-feb253ff cache-gradle-1.4-M3-feb253ff Cache cache-gradle-1.4.0-017fd2