Devops-ify your life with Github Actions

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.

3dc29e8cfc6ef333e2b41a1b0e826b57?s=128

Nicola Corti

August 09, 2020
Tweet

Transcript

  1. Devops-ify your life with Github Actions @cortinico

  2. Nicola Corti Android Infra Engineer @cortinico ✈

  3. Nicola Corti Android Infra Engineer twitter.com/cortinico ✈ Slides are here

    :)
  4. Continuous Integration

  5. Continuous Integration Pull Request Main Main Build Analyse Test

  6. Continuous Delivery Main

  7. Continuous Delivery Main Candidate Release Artifact Deploy Test

  8. CI/CD Tools Travis CI Circle CI Bitrise TeamCity Jenkins

  9. None
  10. None
  11. None
  12. None
  13. None
  14. None
  15. None
  16. None
  17. None
  18. Workflows

  19. build-workflow.yml

  20. build-workflow.yml release-workflow.yml cleanup-workflow.yml

  21. build-workflow.yml release-workflow.yml cleanup-workflow.yml Triggers

  22. build-workflow.yml release-workflow.yml cleanup-workflow.yml Pull-request Push Comment Schedule

  23. build-workflow.yml release-workflow.yml cleanup-workflow.yml Pull-request Push Comment Schedule

  24. build-workflow.yml release-workflow.yml cleanup-workflow.yml Pull-request Push Comment Schedule Gradle Gradle Lock

    Issue
  25. build-workflow.yml release-workflow.yml cleanup-workflow.yml Pull-request Push Comment Schedule Gradle Gradle Upload

    to Bintray Upload to Sonatype Lock Issue
  26. name: Build

  27. name: Build on: push: branches: - '*'

  28. name: Build on: push: branches: - '*' pull_request: branches: -

    '*'
  29. name: Build on: push: branches: - '*' pull_request: branches: -

    '*' jobs: gradle:
  30. name: Build on: push: branches: - '*' pull_request: branches: -

    '*' jobs: gradle: runs-on: [ubuntu-latest]
  31. name: Build on: push: branches: - '*' pull_request: branches: -

    '*' jobs: gradle: runs-on: [ubuntu-latest] steps: - name: Checkout Repo uses: actions/checkout@v2
  32. 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
  33. 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
  34. 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
  35. github.com/AppIntro/AppIntro

  36. github.com/AppIntro/AppIntro

  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. github.com/AppIntro/AppIntro

  43. 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
  44. 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
  45. 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
  46. github.com/detekt/detekt

  47. github.com/detekt/detekt/

  48. github.com/detekt/detekt/ jobs: gradle: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}

  49. 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 }}
  50. 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 }}
  51. 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
  52. 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
  53. 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 }}
  54. 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 }}
  55. None
  56. name: Release to Play Store on: push: branches: - release

  57. 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
  58. 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 }}
  59. 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 }}
  60. 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/upload-google-play@v1.0.4 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: it.gdgdevparty.sample releaseFile: app/build/outputs/bundle/release/app-release.aab track: beta
  61. 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/upload-google-play@v1.0.4 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: it.gdgdevparty.sample releaseFile: app/build/outputs/bundle/release/app-release.aab track: beta
  62. github.com/ChuckerTeam/chucker

  63. github.com/ChuckerTeam/chucker

  64. 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
  65. 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
  66. github.com/ChuckerTeam/chucker

  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. Let’s Devops-ify Something! @cortinico