E2E Tests #17
Workflow file for this run
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: E2E Tests | |
on: [deployment_status] | |
jobs: | |
Setup: | |
if: github.event.deployment_status.state == 'success' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx install pipenv | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
# Can't use cache because of https://github.com/actions/cache/issues/319 | |
# cache: 'pipenv' | |
- name: Install bootstrapper dependencies | |
run: pipenv install --dev --deploy | |
- run: | | |
config_file=$(./scripts/vue_or_react.sh) | |
pipenv run cookiecutter . --config-file $config_file --no-input -f | |
cat $config_file | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: my_project | |
path: my_project/ | |
retention-days: 1 | |
Playwright: | |
needs: Setup | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
if: github.event.deployment_status.state == 'success' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: my_project | |
path: my_project/ | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: 📦 Install frontend dependencies | |
working-directory: ./my_project/client | |
run: npm install | |
- name: 🎭 Install Playwright | |
working-directory: ./my_project/client | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests against ${{ github.event.deployment_status.environment_url }} | |
working-directory: ./my_project/client | |
run: npx playwright test --reporter=html | |
env: | |
NPM_CONFIG_PRODUCTION: false | |
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.environment_url }} | |
PLAYWRIGHT_TEST_USER_PASS: ${{ secrets.CYPRESS_TEST_USER_PASS }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: my_project/client/playwright-report/ | |
retention-days: 30 | |
configuremobile: | |
needs: Setup | |
runs-on: ubuntu-latest | |
outputs: | |
BUILD_MOBILE_APP: ${{ steps.checkdiff.outputs.BUILD_MOBILE_APP }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 5 | |
name: check diff | |
- id: checkdiff | |
run: | | |
git fetch origin main | |
echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l) | |
echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT | |
getprnumber: | |
runs-on: ubuntu-latest | |
needs: configuremobile | |
if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 | |
steps: | |
- uses: jwalton/gh-find-current-pr@master | |
id: findPr | |
- name: Set name for PR | |
if: success() && steps.findPr.outputs.number | |
run: echo "PR=pr-${PR}" >> $GITHUB_ENV | |
env: | |
PR: ${{ steps.findPr.outputs.pr }} | |
outputs: | |
PR: ${{ env.PR }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: getprnumber | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: my_project | |
path: my_project/ | |
- uses: actions/cache@v4 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: 🏗 Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.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 | |
working-directory: ./my_project/mobile | |
run: yarn install | |
- name: Copy Config files | |
run: | | |
ls | |
cp resources/app-bs.config.js my_project/mobile/app.config.js | |
cp resources/eas-bs.json my_project/mobile/eas.json | |
- name: 🚀 Publish preview | |
working-directory: ./my_project/mobile | |
run: | | |
eas update --branch="${{ needs.getprnumber.outputs.PR }}" --non-interactive --auto | |
echo "${{ env.BACKEND_SERVER_URL }} and ${{ needs.getprnumber.outputs.PR }}" | |
env: | |
EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" | |
EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" |