Skip to content

Instantly share code, notes, and snippets.

@fkirc
Last active October 2, 2020 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkirc/352f6da86ff18ee7d70e3dc8b1197e71 to your computer and use it in GitHub Desktop.
Save fkirc/352f6da86ff18ee7d70e3dc8b1197e71 to your computer and use it in GitHub Desktop.
Capacitor Cross-platform GitHub Action: npm + Android
name: CI
on:
push:
workflow_dispatch:
jobs:
pre_job:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths_ignore: '["**/*.md"]'
ci:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip == 'false' }}
runs-on: ubuntu-latest # For enterprise users, macos is 10x more expensive (as of 9/2020)
timeout-minutes: 30
steps:
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: actions/checkout@v2
with:
token: ${{ secrets.CI_PAT }} # Recursive workflow-triggering does not work with regular GitHub token
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: pwd && ls -la
- run: yarn install --frozen-lockfile
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
cancel_others: 'false'
paths: '["**/public/locales/**"]'
- name: Re-generate translations
if: ${{ steps.skip_check.outputs.should_skip == 'false' }}
run: |
git diff --exit-code
./translate.sh
git config --global user.name "Automated Translations"
git config --global user.email "translation.bot@github.com"
git commit -am "Re-generate translations" || true
git diff --exit-code
git push origin
- run: yarn run lint
- run: yarn run build
- run: git submodule update --init
- run: npx cap sync android
- name: Android Tests
run: |
git fetch origin --depth=1 ${{ env.ref-branch }}
if ! git diff --name-only origin/${{ env.ref-branch }} | grep android; then
echo "Skip Android tests because nothing changed" && exit 0
fi
cd android && pwd
./gradlew lintProductionRelease
./gradlew app:testProductionReleaseUnitTest
env:
ref-branch: "develop"
#- name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v2
@fkirc
Copy link
Author

fkirc commented Oct 2, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment