Skip to content

Commit

Permalink
Improve CI scripts (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
mars885 authored Aug 18, 2024
1 parent 6754fab commit a42f4c6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 155 deletions.
23 changes: 0 additions & 23 deletions .github/ci-gradle.properties

This file was deleted.

88 changes: 25 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [ master ]

env:
JDK_JAVA_DISTRIBUTION: 'temurin'
JDK_JAVA_VERSION: '17'

jobs:
static-analysis:
name: Static Analysis
Expand All @@ -14,30 +18,16 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
distribution: ${{ env.JDK_JAVA_DISTRIBUTION }}
java-version: ${{ env.JDK_JAVA_VERSION }}

- name: Copy CI Gradle Properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Cache Gradle Folders
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/
~/.gradle/wrapper/
key: cache-gradle-${{ runner.os }}-${{ hashFiles('checksum.txt') }}
restore-keys: |
cache-gradle-${{ runner.os }}-
cache-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Run Static Analysis Tools
run: ./gradlew lint --continue
Expand All @@ -48,30 +38,16 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
distribution: ${{ env.JDK_JAVA_DISTRIBUTION }}
java-version: ${{ env.JDK_JAVA_VERSION }}

- name: Copy CI Gradle Properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Cache Gradle Folders
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/
~/.gradle/wrapper/
key: cache-gradle-${{ runner.os }}-${{ hashFiles('checksum.txt') }}
restore-keys: |
cache-gradle-${{ runner.os }}-
cache-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Run Unit Tests
run: ./gradlew test
Expand All @@ -82,30 +58,16 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
distribution: ${{ env.JDK_JAVA_DISTRIBUTION }}
java-version: ${{ env.JDK_JAVA_VERSION }}

- name: Copy CI Gradle Properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Cache Gradle Folders
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/
~/.gradle/wrapper/
key: cache-gradle-${{ runner.os }}-${{ hashFiles('checksum.txt') }}
restore-keys: |
cache-gradle-${{ runner.os }}-
cache-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build Debug APK
run: ./gradlew assembleDebug
20 changes: 0 additions & 20 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

42 changes: 16 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,37 @@ on:
tags:
- 'v*'

env:
JDK_JAVA_DISTRIBUTION: 'temurin'
JDK_JAVA_VERSION: '17'

jobs:
release:
name: Create a GitHub Release
runs-on: [ubuntu-latest]
permissions:
contents: write

steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
distribution: ${{ env.JDK_JAVA_DISTRIBUTION }}
java-version: ${{ env.JDK_JAVA_VERSION }}

- name: Copy CI Gradle Properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Cache Gradle Folders
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/
~/.gradle/wrapper/
key: cache-gradle-${{ runner.os }}-${{ hashFiles('checksum.txt') }}
restore-keys: |
cache-gradle-${{ runner.os }}-
cache-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build Debug APK
run: ./gradlew assembleDebug

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
name: Release ${{ github.ref }}
draft: true
prerelease: false
files: app/build/outputs/apk/debug/sample-debug.apk
23 changes: 0 additions & 23 deletions checksum.sh

This file was deleted.

0 comments on commit a42f4c6

Please sign in to comment.