chore: update github actions for rn #4558
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
name: Run checks on Pull Requests | |
on: | |
pull_request: | |
jobs: | |
enforce_title: | |
name: Enforce PR Title Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: "0" | |
submodules: "recursive" | |
- name: Setup Node | |
uses: ./.github/actions/setup-node | |
- name: Use commitlint to check PR title | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
run: echo "$TITLE" | yarn commitlint | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.ALCHEMY_BOT_PAT }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.ALCHEMY_BOT_PAT }} | |
fetch-depth: "0" | |
- name: Setup Node | |
uses: ./.github/actions/setup-node | |
- name: Build eslint plugin | |
run: | | |
cd templates/eslint && yarn build | |
- uses: reviewdog/action-setup@v1 | |
with: | |
reviewdog_version: latest | |
- name: Run eslint with reviewdog | |
run: | | |
npx --no-install -c "eslint -f=rdjson ." | reviewdog -f=rdjson -reporter=github-pr-review -filter-mode=added -tee | |
- name: Run eslint for errors | |
run: yarn lint:check | |
build_and_lint_and_test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: "0" | |
submodules: "recursive" | |
# using your own fork url avoids getting rate limited by the public api | |
# later we'll look at deploying everything we need directly to anvil so | |
# so we don't need a fork url | |
- name: Conditionally set fork url | |
if: ${{ env.API_KEY != '' }} | |
run: echo "VITEST_SEPOLIA_FORK_URL=https://eth-sepolia.g.alchemy.com/v2/${{ env.API_KEY }}" >> $GITHUB_ENV | |
- name: Set up foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Set up Rundler | |
uses: jaxxstorm/action-install-gh-release@v1.12.0 | |
with: | |
repo: alchemyplatform/rundler | |
platform: linux | |
tag: v0.2.2 | |
cache: enable | |
- name: Setup Node | |
uses: ./.github/actions/setup-node | |
- name: Build Libraries | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
run: yarn build:libs | |
- name: Unit Test | |
run: yarn test:ci | |
build_android: | |
name: Build Android | |
runs-on: ubuntu-latest | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
steps: | |
- name: "Checkout files" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: "0" | |
submodules: "recursive" | |
- name: Setup Node | |
uses: ./.github/actions/setup-node | |
- name: Check turborepo cache for Android | |
run: | | |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --dry=json | sed '1,2d;$d')).tasks.find(t => t.task === 'build:android').cache.status") | |
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then | |
echo "turbo_cache_hit=1" >> $GITHUB_ENV | |
fi | |
- name: Install JDK | |
if: env.turbo_cache_hit != 1 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Finalize Android SDK | |
if: env.turbo_cache_hit != 1 | |
run: | | |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" | |
- name: Cache Gradle | |
if: env.turbo_cache_hit != 1 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/wrapper | |
~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build RN Library | |
run: yarn prepare | |
- name: Build example for Android | |
env: | |
JAVA_OPTS: "-XX:MaxHeapSize=6g" | |
run: | | |
yarn turbo run build:android | |