Skip to content

Drill cards (#254) #747

Drill cards (#254)

Drill cards (#254) #747

Workflow file for this run

name: "Pipeline"
on:
workflow_dispatch:
push:
paths-ignore:
- ".github/**"
- "docs/**"
- "cypress/**"
- "**/*.test.ts"
- "README.md"
- "License.md"
- ".gitignore"
- ".prettierignore"
- ".prettierrc.json"
- "cypress.config.ts"
branches:
- main
pull_request:
paths-ignore:
- ".github/**"
- "docs/**"
- "README.md"
- "License.md"
- ".gitignore"
- ".prettierignore"
- ".prettierrc.json"
- "cypress.config.ts"
branches:
- main
# https://stackoverflow.com/questions/74117321/if-condition-in-concurrency-in-gha
# A PR will have workflows in the same group, different PRs will have workflows in different groups, and each main workflow will have different group IDs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
code_scan:
runs-on: ubuntu-latest
steps:
- name: πŸ— Setup repo
uses: actions/checkout@v3
- name: Prettier Check
run: |
npm i [email protected]
npx prettier --check .
app_preview_dev:
if: ${{ contains(fromJSON('["pull_request"]'), github.event_name)}}
runs-on: ubuntu-latest
needs: [ code_scan ]
steps:
- name: πŸ— Setup repo
uses: actions/checkout@v3
- name: πŸ— Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: πŸ— Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: πŸ“¦ Install dependencies
run: npm ci && npx expo install expo-updates
- name: πŸš€ Publish App preview
run: USERGAMESTATISTICSBFFURL=${{ secrets.DEV_USERGAMESTATISTICSBFFURL }} USERACTIVEGAMESBFFURL=${{ secrets.DEV_USERACTIVEGAMESBFFURL }} DOMAIN=${{ secrets.DEV_DOMAIN }} CLIENT_ID=${{ secrets.DEV_CLIENT_ID }} AUDIENCE=${{ secrets.DEV_AUDIENCE }} SCOPE=${{ secrets.DEV_SCOPE }} expo publish --release-channel=pr-${{ github.event.number }} --non-interactive
- name: Publish Website Preview
run: echo "previewUrl=$(npx vercel --yes --name sudokuru-dev --token ${{secrets.VERCEL_TOKEN}})" >> $GITHUB_ENV
- name: Post comment with preview link
uses: KeisukeYamashita/create-comment@v1
with:
check-only-first-line: true
comment: |
Preview App for PR:
https://expo.dev/@sudokuru/sudokuru?serviceType=classic&distribution=expo-go&release-channel=pr-${{ github.event.number }}
Preview Website for PR:
${{ env.previewUrl }}
website_test_dev:
runs-on: ubuntu-latest
needs: [ code_scan ]
steps:
- name: πŸ— Setup repo
uses: actions/checkout@v3
- name: πŸ— Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: install dependencies
run: npm i
- name: Jest run
run: npm run test:unit
- name: Test Reporter
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: JEST Tests
path: junit.xml
reporter: jest-junit
- name: Cypress run
uses: cypress-io/github-action@v5
with:
start: 'npm run web:dev'
command: 'npm run test:cypress'
wait-on: 'http://localhost:19000/'
wait-on-timeout: 120
- name: Coveralls
uses: coverallsapp/github-action@v2
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- run: npx nyc report --reporter=text > coverage-final.txt
working-directory: ./coverage
- uses: fingerprintjs/action-coverage-report-md@v1
id: coverage
with:
textReportPath: './coverage/coverage-final.txt'
srcBasePath: ''
- run: |
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Code Coverage" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.coverage.outputs.markdownReport }}" >> $GITHUB_STEP_SUMMARY
- uses: marocchino/sticky-pull-request-comment@v2
if: ${{ contains(fromJSON('["pull_request"]'), github.event_name)}}
with:
message: ${{ steps.coverage.outputs.markdownReport }}
app_build_android:
runs-on: ubuntu-latest
needs: [ code_scan ]
steps:
- name: πŸ— Setup repo
uses: actions/checkout@v3
- name: πŸ— Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: πŸ— Setup Expo and EAS
uses: expo/expo-github-action@v7
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: πŸ“¦ Install dependencies
run: npm ci
- name: πŸš€ Build app
run: eas build --non-interactive --platform android --local
env:
EAS_LOCAL_BUILD_ARTIFACTS_DIR: Build
- name: Upload APK Artifact
uses: actions/upload-artifact@v3
with:
name: Android APK
path: Build/*.apk
deploy_app_dev:
name: Deploy Dev app to Itch.io
needs: [ app_build_android, website_test_dev ]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Download APK Artifact
uses: actions/download-artifact@v3
with:
name: Android APK
- name: Install Butler
run: |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
./butler -V
- name: Update Itch.io Android Alpha App
run: ./butler push . ${{secrets.ITCH_USERNAME}}/${{secrets.ITCH_GAME_ID}}:alpha-android
env:
BUTLER_API_KEY: ${{secrets.BUTLER_API_KEY}}
deploy_app_prod:
name: Deploy Prod app to Itch.io
needs: [ deploy_website_dev, deploy_app_dev ]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Download APK Artifact
uses: actions/download-artifact@v3
with:
name: Android APK
- name: Install Butler
run: |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
./butler -V
- name: Update Itch.io Android Prod App
run: ./butler push . ${{secrets.ITCH_USERNAME}}/${{secrets.ITCH_GAME_ID}}:stable-android
env:
BUTLER_API_KEY: ${{secrets.BUTLER_API_KEY}}
deploy_website_dev:
name: Deploy Dev Website
needs: [ app_build_android, website_test_dev ]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- run: npm ci
- run: npx vercel --yes --prod --name sudokuru-dev --token ${{secrets.VERCEL_TOKEN}}
deploy_website_prod:
name: Deploy Prod Website
needs: [ deploy_website_dev, deploy_app_dev ]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- run: npm ci
- run: npx vercel --yes --prod --name sudokuru --token ${{secrets.VERCEL_TOKEN}}