-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from EranBoudjnah/migrate_to_github_actions
Migrated from Travis to Github Actions.
- Loading branch information
Showing
4 changed files
with
111 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: 'Cache Build' | ||
description: 'Cache build paths' | ||
inputs: | ||
key: | ||
description: 'Cache key' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Cache build artifacts | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
app/build | ||
key: ${{ inputs.key }} | ||
restore-keys: | | ||
${{ inputs.key }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Kotlin-Linter | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
ktlint: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Get changed files | ||
id: changes | ||
run: | | ||
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | ||
RESPONSE=$(curl -s -X GET -G $URL --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}') | ||
CHANGED_KOTLIN_FILES=$(echo $RESPONSE | jq -r '.[] | .filename' | grep -E "\.kt$" | tr \'\\n\' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//') | ||
echo "Changed Kotlin files: ${CHANGED_KOTLIN_FILES}" | ||
echo "changed_kotlin_files=${CHANGED_KOTLIN_FILES}" >> $GITHUB_ENV | ||
- name: "checkout" | ||
if: env.changed_kotlin_files != '' | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install ktlint | ||
if: env.changed_kotlin_files != '' | ||
run: | | ||
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.50.0/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/ | ||
- name: run ktlint | ||
if: env.changed_kotlin_files != '' | ||
run: | | ||
ktlint . '!**/build/**' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Android CI | ||
|
||
env: | ||
cache-name: android-gradle | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
setup: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
cache: gradle | ||
|
||
- name: Cache build artifacts | ||
uses: ./.github/actions/cache-build-paths | ||
with: | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Assemble with Gradle | ||
run: ./gradlew jar | ||
|
||
unit-tests: | ||
needs: setup | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
cache: gradle | ||
|
||
- name: Cache build artifacts | ||
uses: ./.github/actions/cache-build-paths | ||
with: | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Run unit tests | ||
run: ./gradlew test |
This file was deleted.
Oops, something went wrong.