Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: adjust ci actions #1614

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/shaggy-cameras-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 1 addition & 1 deletion .github/workflows/docs-scrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Docker
uses: FuelLabs/github-actions/setups/docker@master
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
name: Devnet tests
name: Network Tests

on:
workflow_dispatch:
inputs:
network:
description: 'Network to run tests on'
required: true
default: 'testnet'
type: choice
options:
- testnet
- devnet
masterMnemonic:
description: Mnemonic of the wallet that will fund the tests
required: false
type: string
push:
branches:
- master
Expand All @@ -16,32 +25,29 @@ concurrency:

jobs:
tests-e2e-contracts:
name: E2E Contract Tests - Devnet
name: E2E Contract Tests - ${{ github.event_name == 'workflow_dispatch' && inputs.network || matrix.network }}
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
matrix:
network: [testnet, devnet]
fail-fast: false
if: github.event_name == 'push' || github.event.inputs.network == matrix.network
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: actions/checkout@v4
- uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run PNPM install
id: pnpm-cache
run:
pnpm recursive install --frozen-lockfile

- name: Generate .env app
run: cp packages/app/.env.example packages/app/.env

- name: Generate .env e2e-contracts
run: cp packages/e2e-contract-tests/.env.example packages/e2e-contract-tests/.env

- name: Run E2E Contract Tests - Devnet
- name: Run E2E Contract Tests
uses: ./.github/actions/e2e-tests-contracts
with:
providerUrl: "https://devnet.fuel.network/v1/graphql"
providerUrl: ${{ matrix.network == 'devnet' && 'https://devnet.fuel.network/v1/graphql' || 'https://testnet.fuel.network/v1/graphql' }}
masterMnemonic: ${{ inputs.masterMnemonic || secrets.VITE_MASTER_WALLET_MNEMONIC }}
149 changes: 31 additions & 118 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,135 +10,56 @@ concurrency:
cancel-in-progress: true

jobs:
tests-jest:
name: JEST Tests
tests:
name: ${{ matrix.test-type }}
timeout-minutes: 20
runs-on: buildjet-8vcpu-ubuntu-2204
env:
NODE_OPTIONS: "--max-old-space-size=4096"
NODE_ENV: test
CI: "true"
strategy:
matrix:
test-type: [jest, e2e, e2e-crx-lock]
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: actions/checkout@v4
- uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Start Test Node
run: pnpm node:up

- name: Generate .env
run: cp packages/app/.env.example packages/app/.env

# 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
timeout-minutes: 10
env:
NODE_OPTIONS: "--max-old-space-size=4096"

- name: Stop Test Node
run: pnpm node:clean

tests-e2e:
name: E2E Tests
timeout-minutes: 20
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
run: pnpm build:libs

- name: Start Test Node
run: pnpm node:up

- name: Generate .env
run: cp packages/app/.env.example packages/app/.env

- name: Build Application
run: pnpm build:app
env:
## increase node.js m memory limit for building
## with sourcemaps
NODE_OPTIONS: "--max-old-space-size=4096"

# E2E tests running with Playwright
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run Jest Tests
if: matrix.test-type == 'jest'
run: pnpm test:ci

- name: Run E2E Tests
run: xvfb-run --auto-servernum -- pnpm test:e2e
if: matrix.test-type == 'e2e'
timeout-minutes: 15
env:
NODE_ENV: test

- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-app-report
path: packages/app/playwright-results
retention-days: 30

- name: Stop Test Node
run: pnpm node:clean

tests-e2e-crx-lock:
name: E2E Tests - Lock CRX
runs-on: buildjet-8vcpu-ubuntu-2204
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Start Test Node
run: pnpm node:up

- name: Generate .env
run: cp packages/app/.env.example packages/app/.env

- name: Build Application
run: pnpm build:app
env:
## increase node.js m memory limit for building
## with sourcemaps
NODE_OPTIONS: "--max-old-space-size=4096"

# E2E tests running with Playwright
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
run: |
pnpm exec playwright install --with-deps chromium
pnpm test:e2e

- name: Run E2E Tests
run: xvfb-run --auto-servernum -- pnpm test:e2e:crx-lock
timeout-minutes: 3
env:
NODE_ENV: test
# - name: Run E2E CRX Lock Tests
# if: matrix.test-type == 'e2e-crx-lock'
# timeout-minutes: 15
# run: |
# pnpm exec playwright install --with-deps chromium
# pnpm test:e2e:crx-lock

- uses: actions/upload-artifact@v4
if: always()
if: always() && matrix.test-type != 'jest'
with:
name: playwright-app-crx-lock-report
name: playwright-${{ matrix.test-type }}-report
path: packages/app/playwright-results
retention-days: 30

Expand All @@ -151,22 +72,14 @@ jobs:
# Commented until the Playwright bug is fixed
if: false
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: actions/checkout@v4
- uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-rust

- name: Run PNPM install
id: pnpm-cache
run:
pnpm recursive install --frozen-lockfile

- name: Start Test Node
run: pnpm node:up

Expand Down
42 changes: 14 additions & 28 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
outputs:
changed: ${{ steps.packages-changed.outputs.any_changed }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check external packages changes
id: packages-changed
uses: tj-actions/[email protected]
Expand All @@ -40,15 +40,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: CI Setup
uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache

- name: Validate Changeset
run: pnpm changeset status --since=origin/${{ github.base_ref }}
Expand All @@ -57,11 +52,8 @@ jobs:
name: Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: actions/checkout@v4
- uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache
- name: Install jq
run: sudo apt-get install jq
- run: |
Expand All @@ -81,16 +73,13 @@ jobs:
echo "No actionable vulnerabilities"
exit 0
fi

strict-audit:
name: Strict Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: actions/checkout@v4
- uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache
- run: pnpm audit --prod

lint:
Expand All @@ -102,23 +91,20 @@ jobs:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache

- name: Run lint
run: |
pnpm ts:check
pnpm lint:ci

docs:
name: Docs
uses: FuelLabs/github-actions/.github/workflows/next-docs.yml@master
with:
doc-folder-path: 'packages/docs/docs'
src-folder-path: 'packages/docs/src'
spellcheck-config-path: 'packages/docs/.spellcheck.yml'
doc-folder-path: "packages/docs/docs"
src-folder-path: "packages/docs/src"
spellcheck-config-path: "packages/docs/.spellcheck.yml"
7 changes: 2 additions & 5 deletions .github/workflows/release-npm-changeset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ jobs:
name: Release master or rc
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# need this to get full git-history/clone in order to build changelogs and check changesets
fetch-depth: 0
# workaround to ensure force pushes to changeset branch use REPO_TOKEN owner's account
# see https://github.com/changesets/action/issues/70
persist-credentials: false
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: FuelLabs/github-actions/setups/node@pn/fix/pnpm-cache
- uses: FuelLabs/github-actions/setups/npm@master
with:
npm-token: ${{ secrets.NPM_TOKEN }}
Expand Down
Loading
Loading