refactor pagination to use URL query parameter and use page & pageSiz… #547
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: Test & Deploy | |
on: [push] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
uses: ./.github/actions/install-dependencies | |
- name: Current timestamp | |
uses: ./.github/actions/now | |
- name: Build | |
env: | |
REACT_APP_COMMIT_SHA: ${{ github.sha }} | |
REACT_APP_BUILD_TIMESTAMP: ${{ env.NOW }} | |
REACT_APP_ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_CLIENT_ACCESS_TOKEN }} | |
run: npm run build | |
- name: Upload build artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: build | |
path: build/ | |
test: | |
name: Test | |
needs: build | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/playwright:v1.37.0-focal | |
strategy: | |
fail-fast: false | |
matrix: | |
shardIndex: [1,2,3,4,5,6,7,8,9,10] | |
shardTotal: [10] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
uses: ./.github/actions/install-dependencies | |
- name: Download build artifact | |
uses: actions/download-artifact@master | |
with: | |
name: build | |
path: build | |
- name: Start app | |
run: npm run start:test & | |
- name: Run Playwright Tests | |
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
- name: Upload test screenshots artifact | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-screenshots | |
path: test/screenshots | |
retention-days: 14 | |
- name: Upload test report artifact | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-blob-reports | |
path: test/report/ | |
retention-days: 14 | |
test-report: | |
name: Test report | |
needs: test | |
if: always() | |
environment: | |
name: test-report | |
url: ${{ steps.pages.outputs.url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
uses: ./.github/actions/install-dependencies | |
- name: Download test screenshots artifact | |
uses: actions/download-artifact@master | |
with: | |
name: test-screenshots | |
path: test/screenshots | |
- name: Download test report artifact | |
uses: actions/download-artifact@master | |
with: | |
name: test-blob-reports | |
path: test/blob-reports | |
- name: Merge blob reports into HTML report | |
run: npx playwright merge-reports --config playwright.merge-reports.config.ts ./test/blob-reports | |
- name: Upload Argos screenshots | |
continue-on-error: true | |
env: | |
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }} | |
run: npx argos upload test/screenshots | |
- name: Deploy test report to Cloudflare Pages | |
id: pages | |
uses: ./.github/actions/deploy-cloudflare-pages | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
project: calamar-test-reports | |
branch: ${{ github.ref_name }} | |
path: test/report | |
preview: | |
name: Deploy / Preview | |
needs: test | |
environment: | |
name: development | |
url: ${{ steps.pages.outputs.url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download build artifact | |
uses: actions/download-artifact@master | |
with: | |
name: build | |
path: build | |
- name: Current timestamp | |
uses: ./.github/actions/now | |
- name: Generate client environment | |
uses: ./.github/actions/generate-client-env | |
env: | |
REACT_APP_PUBLISH_TIMESTAMP: ${{ env.NOW }} | |
REACT_APP_ROLLBAR_ENV: development | |
REACT_APP_ROLLBAR_ENABLED: ${{ github.ref_name == 'master' && 'true' || 'false' }} | |
with: | |
file: build/env.js | |
- name: Deploy to Cloudflare Pages | |
id: pages | |
uses: ./.github/actions/deploy-cloudflare-pages | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
project: calamar | |
branch: ${{ github.ref_name }} | |
path: build | |
- name: Deploy to Rollbar | |
if: github.ref_name == 'master' | |
uses: ./.github/actions/deploy-rollbar | |
with: | |
accessToken: ${{ secrets.ROLLBAR_SERVER_ACCESS_TOKEN }} | |
environment: development | |
urls: ${{ steps.pages.outputs.url }} ${{ steps.pages.outputs.aliases }} | |
path: build | |
deploy: | |
name: Deploy / Production | |
needs: test | |
if: github.ref_name == 'master' | |
environment: | |
name: production | |
url: ${{ steps.pages.outputs.url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download build artifact | |
uses: actions/download-artifact@master | |
with: | |
name: build | |
path: build | |
- name: Current timestamp | |
uses: ./.github/actions/now | |
- name: Generate client environment | |
uses: ./.github/actions/generate-client-env | |
env: | |
REACT_APP_PUBLISH_TIMESTAMP: ${{ env.NOW }} | |
REACT_APP_ROLLBAR_ENV: production | |
REACT_APP_ROLLBAR_ENABLED: true | |
with: | |
file: build/env.js | |
- name: Deploy to Cloudflare Pages | |
id: pages | |
uses: ./.github/actions/deploy-cloudflare-pages | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
project: calamar | |
branch: production | |
path: build | |
- name: Deploy to Rollbar | |
uses: ./.github/actions/deploy-rollbar | |
with: | |
accessToken: ${{ secrets.ROLLBAR_SERVER_ACCESS_TOKEN }} | |
environment: production | |
urls: ${{ steps.pages.outputs.url }} ${{ steps.pages.outputs.aliases }} | |
path: build |