Skip to content

Instantly share code, notes, and snippets.

@hernandazevedo
Last active May 31, 2021 13:09
Show Gist options
  • Save hernandazevedo/77739a00ec9e08494277c3e523ec075d to your computer and use it in GitHub Desktop.
Save hernandazevedo/77739a00ec9e08494277c3e523ec075d to your computer and use it in GitHub Desktop.
.github/workflows
name: Android Pull Request
on:
push:
branches:
- main
pull_request:
jobs:
pr-verification:
name: PR Check Android
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
# Gems for Fastlane
- name: Cache ruby gems dependencies
id: cache-gems
uses: actions/cache@v2
env:
keyPath: ${{ runner.os }}-gems
with:
path: ~/.gem
key: ${{ runner.os }}-build-${{ env.keyPath }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: ${{ runner.os }}-build-${{ env.keyPath }}-
- name: Install gem dependencies
if: steps.cache-gems.outputs.cache-hit != 'true'
run: bundle config set path '~/.gem' && bundle install
- name: Cache gradle dependences
uses: actions/cache@v2
env:
gradle-cache-key: gradle-cache-android
gradle-path: ~/.gradle
with:
path: ${{ env.gradle-path }}
key: ${{ runner.os }}-build-${{ env.gradle-cache-key }}-${{ hashFiles('android/buildSrc/**') }}
restore-keys: ${{ runner.os }}-build-${{ env.gradle-cache-key }}
- name: Run pr check
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
GITHUB_USER: ${{ secrets.REPO_USER }}
run: bundle exec fastlane pull_request_verification
### Place this file under directory fastlane/Fastfile
### PR Android
###
desc "Pull Request verification"
lane :pull_request_verification do
gradle(project_dir: ".", task: "clean lintDebug test")
end
### Place this file on root directory of your github repository
source 'https://rubygems.org'
gem 'fastlane'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment