This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 264
feat: make tests run in parallel #352
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3b12788
feat: make tests run in parallel
LuizAsFight 052fbc6
chore: rename action
LuizAsFight b96ff59
chore: remove debugging
LuizAsFight 4e8023f
Merge branch 'master' of github.com:FuelLabs/swayswap into lf-309/fea…
LuizAsFight 58d3012
feat: use composite actions to centralize code
LuizAsFight 810c8c4
chore: include lint before tests
LuizAsFight 2578cea
fix: stop tests if lint fail
LuizAsFight 0ef30b1
chore: remove dup lints
LuizAsFight e4bbfe7
chore: remove comment
LuizAsFight File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: 'Setup Docker' | ||
inputs: | ||
compose-version: | ||
description: 'Docker-compose version' | ||
default: 2.6.0 | ||
password: | ||
description: 'Password' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Docker | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ inputs.password }} | ||
|
||
# Make github action to use the latest version of | ||
# docker compose without it docker compose down | ||
# has issues with memory nil pointer | ||
# https://github.com/docker/compose/pull/9354 | ||
- name: Install Compose | ||
uses: ndeloof/[email protected] | ||
with: | ||
version: v${{ inputs.compose-version }} | ||
|
||
- name: Docker info | ||
run: | | ||
docker info | ||
shell: | ||
bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'Setup Node.js env' | ||
inputs: | ||
node-version: | ||
description: 'Node version' | ||
default: 16 | ||
pnpm-version: | ||
description: 'PNPM version' | ||
default: 7.0.0 | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Cache PNPM modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/[email protected] | ||
with: | ||
version: ${{ inputs.pnpm-version }} | ||
run_install: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: 'Setup Rust env' | ||
inputs: | ||
rust-version: | ||
description: 'Rust version' | ||
default: 1.61.0 | ||
forc-version: | ||
description: 'Forc version' | ||
default: 0.16.1 | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ inputs.rust-version }} | ||
# selecting a toolchain either by action or manual `rustup` calls should happen | ||
# before the cache plugin, as it uses the current rustc version as its cache key | ||
override: true | ||
|
||
- uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Set git config | ||
run: | | ||
git config --global core.bigfilethreshold 100m | ||
shell: | ||
bash | ||
|
||
- name: Install Forc | ||
run: | | ||
curl -sSLf https://github.com/FuelLabs/sway/releases/download/v${{ inputs.forc-version }}/forc-binaries-linux_amd64.tar.gz -L -o forc.tar.gz | ||
tar -xvf forc.tar.gz | ||
chmod +x forc-binaries/forc | ||
mv forc-binaries/forc /usr/local/bin/forc | ||
shell: | ||
bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,50 +74,9 @@ jobs: | |
name: Build and deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ env.RUST_VERSION }} | ||
override: true | ||
# selecting a toolchain either by action or manual `rustup` calls should happen | ||
# before the cache plugin, as it uses the current rustc version as its cache key | ||
- uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Set git config | ||
run: | | ||
git config --global core.bigfilethreshold 100m | ||
|
||
- name: Install Forc | ||
run: | | ||
curl -sSLf https://github.com/FuelLabs/sway/releases/download/v${{ env.FORC_VERSION }}/forc-binaries-linux_amd64.tar.gz -L -o forc.tar.gz | ||
tar -xvf forc.tar.gz | ||
chmod +x forc-binaries/forc | ||
mv forc-binaries/forc /usr/local/bin/forc | ||
shell: bash | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Cache PNPM modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/[email protected] | ||
with: | ||
version: ${{ env.PNPM_VERSION }} | ||
run_install: true | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/setup-node | ||
- uses: ./.github/setup-rust | ||
|
||
- name: Setup scripts | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,36 +4,13 @@ on: | |
release: | ||
types: [published] | ||
|
||
env: | ||
NODE_VERSION: "16" | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "16" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Cache PNPM modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 7.0.0 | ||
run_install: true | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/setup-node | ||
|
||
- name: Build | ||
env: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,6 @@ on: | |
pull_request: | ||
types: [opened, synchronize, edited, closed] | ||
|
||
env: | ||
RUST_VERSION: 1.61.0 | ||
FORC_VERSION: 0.16.1 | ||
NODE_VERSION: 16 | ||
PNPM_VERSION: 7.0.0 | ||
COMPOSE_VERSION: 2.6.0 | ||
|
||
jobs: | ||
cancel-previous-run: | ||
name: Cancel previous actions | ||
|
@@ -30,59 +23,25 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-and-test: | ||
name: Build and test | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Cache PNPM modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/[email protected] | ||
with: | ||
version: ${{ env.PNPM_VERSION }} | ||
run_install: true | ||
|
||
# Check lint as early as possible to avoid | ||
# Long fail CI and fail on this step | ||
- name: Lint | ||
run: | | ||
pnpm lint | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/setup-node | ||
- run: pnpm lint | ||
|
||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
continue-on-error: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/setup-node | ||
- uses: ./.github/setup-rust | ||
- uses: ./.github/setup-docker | ||
with: | ||
profile: minimal | ||
toolchain: ${{ env.RUST_VERSION }} | ||
override: true | ||
# selecting a toolchain either by action or manual `rustup` calls should happen | ||
# before the cache plugin, as it uses the current rustc version as its cache key | ||
- uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Set git config | ||
run: | | ||
git config --global core.bigfilethreshold 100m | ||
|
||
- name: Install Forc | ||
run: | | ||
curl -sSLf https://github.com/FuelLabs/sway/releases/download/v${{ env.FORC_VERSION }}/forc-binaries-linux_amd64.tar.gz -L -o forc.tar.gz | ||
tar -xvf forc.tar.gz | ||
chmod +x forc-binaries/forc | ||
mv forc-binaries/forc /usr/local/bin/forc | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# As contracts are really Heavy to build | ||
# and test we only test it when some | ||
|
@@ -102,26 +61,6 @@ jobs: | |
run: | | ||
./scripts/test-contracts.sh | ||
|
||
- name: Setup Docker | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Make github action to use the latest version of | ||
# docker compose without it docker compose down | ||
# has issues with memory nil pointer | ||
# https://github.com/docker/compose/pull/9354 | ||
- name: Install Compose | ||
uses: ndeloof/[email protected] | ||
with: | ||
version: v${{ env.COMPOSE_VERSION }} | ||
|
||
- name: Docker info | ||
run: | | ||
docker info | ||
|
||
- name: Setup scripts | ||
run: | | ||
pnpm scripts:setup | ||
|
@@ -130,6 +69,22 @@ jobs: | |
run: | | ||
pnpm ci:test:coverage | ||
|
||
end-to-end-test: | ||
name: Test E2E | ||
runs-on: ubuntu-latest | ||
continue-on-error: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/setup-node | ||
- uses: ./.github/setup-rust | ||
- uses: ./.github/setup-docker | ||
with: | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup scripts | ||
run: | | ||
pnpm scripts:setup | ||
|
||
# using same dependencies from cypress/browsers:node16.5.0-chrome97-ff96 ... | ||
# not using directly the container because we still need ubuntu-latest preset | ||
- name: Install Cypress Dependencies | ||
|
@@ -176,5 +131,6 @@ jobs: | |
# Recommended: pass the GitHub token lets this action correctly | ||
# determine the unique run id necessary to re-run the checks | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DEBUG: "cypress:server:*" | ||
NODE_ENV: "test" | ||
# debugging seems to make tests slower randomly. you can include if you need to track issues in CI | ||
# DEBUG: "cypress:server:*" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove it if will not be required