feat: improve sdks and tests #2505
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: Tests | |
on: | |
pull_request: | |
branches: [main, master, sdk-v2] | |
types: [opened, synchronize, reopened] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
COVERAGE_FILE: ./coverage/report.json | |
jobs: | |
tests-jest: | |
name: JEST Tests | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: FuelLabs/github-actions/setups/node@master | |
- uses: FuelLabs/github-actions/setups/docker@master | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Start Test Node | |
run: pnpm node:up:test | |
- name: Graphql Codegen | |
run: pnpm codegen:app | |
env: | |
NODE_ENV: test | |
# Unit tests running with JEST | |
- name: Find PR number | |
uses: jwalton/gh-find-current-pr@v1 | |
id: findPr | |
- name: Build libs | |
run: | | |
pnpm build:libs | |
- name: Run Jest Tests | |
run: | | |
pnpm test:ci --outputFile="${{ env.COVERAGE_FILE }}" | |
timeout-minutes: 20 | |
env: | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
- name: Publish coverage | |
uses: artiomtr/jest-coverage-report-action@v2.0.5 | |
if: ${{ steps.findPr.outputs.number }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
package-manager: pnpm | |
annotations: failed-tests | |
test-script: pnpm test:ci | |
working-directory: ./packages/app | |
coverage-file: ${{ env.COVERAGE_FILE }} | |
base-coverage-file: ${{ env.COVERAGE_FILE }} | |
- name: Stop Test Node | |
run: pnpm node:clean:test | |
tests-e2e: | |
name: E2E Tests | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: FuelLabs/github-actions/setups/node@master | |
- uses: FuelLabs/github-actions/setups/docker@master | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Start Test Node | |
run: pnpm node:up:test | |
- name: Graphql Codegen | |
run: pnpm codegen:app | |
env: | |
NODE_ENV: test | |
- name: Build Application | |
run: pnpm build:test | |
env: | |
## increase node.js m memory limit for building | |
## with sourcemaps | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
NODE_ENV: test | |
# E2E tests running with Playwright | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps chromium | |
- name: Run E2E Tests | |
run: xvfb-run --auto-servernum -- pnpm test:e2e | |
env: | |
NODE_ENV: test | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
- name: Stop Test Node | |
run: pnpm node:clean:test | |
tests-e2e-contracts: | |
name: E2E Contract Tests | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: FuelLabs/github-actions/setups/node@master | |
- uses: ./.github/setup-forc | |
- uses: FuelLabs/github-actions/setups/docker@master | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
## This is needed because for some reason setup-forc and setup-node | |
## Override eachothers installations | |
- name: Run PNPM install | |
id: pnpm-cache | |
run: | |
pnpm recursive install --frozen-lockfile | |
- name: Start Test Node | |
run: pnpm node:up:test | |
- name: Build Application | |
run: pnpm build:test-e2e-contracts | |
env: | |
## increase node.js m memory limit for building | |
## with sourcemaps | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
NODE_ENV: test | |
- name: Build Contracts | |
run: forc build --path packages/e2e-contract-tests/contracts/custom_asset | |
- name: Deploy Contracts | |
run: | | |
forc deploy --path packages/e2e-contract-tests/contracts/custom_asset --node-url http://localhost:4001/graphql --default-salt 0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298 | |
forc deploy --path packages/e2e-contract-tests/contracts/custom_asset --node-url http://localhost:4001/graphql --salt 0x0000000000000000000000000000000000000000000000000000000000000001 0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298 | |
- name: Generate Contract Types | |
run: pnpm build:e2e-contracts-types | |
# E2E tests running with Playwright | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps chromium | |
- name: Run E2E Contract Tests | |
run: xvfb-run --auto-servernum -- pnpm test:e2e:contracts | |
env: | |
NODE_ENV: test | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: playwright-report | |
path: packages/e2e-contract-tests/playwright-report/ | |
retention-days: 30 | |
- name: Stop Test Node | |
run: pnpm node:clean:test | |