|
| 1 | +name: WeLearn |
| 2 | +run-name: ${{ github.actor }} is testing WeLearn 🚀 |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + tags: |
| 8 | + - '**' |
| 9 | + - '!**_deploy' |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-docker: |
| 17 | + uses: CyberCRI/github-workflows/.github/workflows/build-push.yaml@main |
| 18 | + with: |
| 19 | + registry-name: ${{ vars.DOCKER_PROD_REGISTRY }} |
| 20 | + image-name: welearn-client |
| 21 | + image-tag: ${{ github.sha }} |
| 22 | + recursive-submodule-checkout: true |
| 23 | + build-args: | |
| 24 | + VITE_API_BASE=$DOCKER_INJECT_VITE_API_BASE |
| 25 | + VITE_ENVIRONMENT=$DOCKER_INJECT_VITE_ENVIRONMENT |
| 26 | + VITE_WL_API_KEY=$DOCKER_INJECT_VITE_WL_API_KEY |
| 27 | + secrets: |
| 28 | + registry-username: ${{ secrets.DOCKER_PROD_USERNAME }} |
| 29 | + registry-password: ${{ secrets.DOCKER_PROD_PASSWORD }} |
| 30 | + submodules-app-id: ${{ secrets.INFRA_BOT_APP_ID }} |
| 31 | + submodules-app-installation-id: ${{ secrets.INFRA_BOT_APP_INSTALLATION_ID }} |
| 32 | + submodules-app-private-key: ${{ secrets.INFRA_BOT_APP_PRIVATE_KEY }} |
| 33 | + |
| 34 | + lint-and-test: |
| 35 | + timeout-minutes: 60 |
| 36 | + runs-on: wlc-lint-and-test-runner |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + - uses: actions/setup-node@v3 |
| 40 | + with: |
| 41 | + node-version: 20 |
| 42 | + - name: Install Yarn |
| 43 | + run: npm install -g yarn |
| 44 | + - name: Install dependencies |
| 45 | + run: yarn install --frozen-lockfile |
| 46 | + |
| 47 | + - name: Run linter and formatter |
| 48 | + run: | |
| 49 | + yarn lint |
| 50 | + yarn format:check |
| 51 | +
|
| 52 | + - name: Run unit tests |
| 53 | + run: yarn test:unit |
| 54 | + |
| 55 | + - name: Install Playwright Browsers |
| 56 | + run: yarn playwright install --with-deps |
| 57 | + - name: Run Playwright tests |
| 58 | + run: yarn playwright test |
| 59 | + - uses: actions/upload-artifact@v4 |
| 60 | + if: always() |
| 61 | + with: |
| 62 | + name: playwright-report |
| 63 | + path: playwright-report/ |
| 64 | + retention-days: 30 |
| 65 | + |
| 66 | + tag-deploy: |
| 67 | + needs: |
| 68 | + - lint-and-test |
| 69 | + - build-docker |
| 70 | + uses: CyberCRI/github-workflows/.github/workflows/tag-deploy.yaml@main |
0 commit comments