From 606da691e63617d1c07929acb4835879bce1f645 Mon Sep 17 00:00:00 2001 From: Chris Banes Date: Wed, 13 Nov 2019 12:44:30 +1100 Subject: [PATCH] Try using GitHub Actions --- .github/workflows/main.yml | 103 +++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..bf66a3d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,103 @@ +name: CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + env: + JAVA_TOOL_OPTIONS: -Xmx5120m + GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2 -Dkotlin.incremental=false -Dkotlin.compiler.execution.strategy=in-process + TERM: dumb + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Decrypt secrets + run: release/signing-setup.sh $ENCRYPT_KEY + env: + ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} + + - name: Generate cache key + run: ./checksum.sh checksum.txt + + - uses: actions/cache@v1 + with: + path: ~/.gradle/caches/modules-2 + key: ${{ runner.os }}-gradlemodules-${{ hashFiles('checksum.txt') }} + restore-keys: | + ${{ runner.os }}-gradlemodules- + + - uses: actions/cache@v1 + with: + path: ~/.gradle/caches/jars-3 + key: ${{ runner.os }}-gradlejars-${{ hashFiles('checksum.txt') }} + restore-keys: | + ${{ runner.os }}-gradlejars- + + - uses: actions/cache@v1 + with: + path: ~/.gradle/caches/build-cache-1 + key: ${{ runner.os }}-gradlebuildcache-${{ hashFiles('checksum.txt') }} + restore-keys: | + ${{ runner.os }}-gradlebuildcache- + + - name: Run Spotless Check + run: ./gradlew spotlessCheck --scan + + - name: Build + run: ./gradlew assemble --scan + + - name: Run tests + run: ./gradlew testDebug --scan + + - name: Run Lint + run: ./gradlew lintDebug dependencyUpdates --scan + + - name: Deploy to Sonatype + if: github.ref == 'refs/heads/master' + run: ./gradlew uploadArchives --no-parallel + env: + SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + + - name: Clean secrets + if: always() + run: release/signing-cleanup.sh + + - name: Upload build outputs + if: always() + uses: actions/upload-artifact@v1 + with: + name: build-outputs + path: app/build/outputs + + - name: Upload build reports + if: always() + uses: actions/upload-artifact@v1 + with: + name: build-reports + path: app/build/reports + + - name: Upload dependency updates report + uses: actions/upload-artifact@v1 + with: + name: dependency-updates + path: build/dependencyUpdates + + - name: Copy test results + if: always() + run: | + mkdir -p junit + find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} junit/ \; + - name: Upload test results + if: always() + uses: actions/upload-artifact@v1 + with: + name: junit-results + path: junit