Skip to content

Commit

Permalink
[WORKFLOWS] Update Nixpkgs Inputs & Update Node Dependencies (#1390)
Browse files Browse the repository at this point in the history
- update nixpkgs
- update ghc
- added node20, but keep node18 as default since subgraph local testing doesn't work with it.
- remove certora
- update node depenencies target minor versions.

Postponing to future PRs:

- next steps:
  - graphql-request related major version update:
    ```
     @graphql-codegen/cli                    ^2.16.5  →  ^5.0.0
     @graphql-codegen/introspection           ^2.2.3  →  ^4.0.0
     @graphql-codegen/typed-document-node    ^2.3.13  →  ^5.0.1
     @graphql-codegen/typescript              ^2.8.8  →  ^4.0.1
     @graphql-codegen/typescript-operations  ^2.5.13  →  ^4.0.1
     ethers                                    5.7.2  →   6.7.0
     graphql-request                          ^4.3.0  →  ^6.1.0
     ```
  - node20-by-default update.
  - improve ethereum-contracts artifacts packaging (1.8.0 release).
  - improve metadata packaging, to support more framework.
- aspirational next steps, keeping up with the Kardashians
  - pnpm migration.
  - sdk-core v2 with multi-frameworks support
- probably never:
  - ethers-v6 update.

Create PR Artifact broken by lerna update. Let it be fore now, to be fixed.
  • Loading branch information
hellwolf authored Aug 11, 2023
1 parent 9ecb24a commit 6f34137
Show file tree
Hide file tree
Showing 70 changed files with 3,156 additions and 2,358 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ indent_size = 4
indent_style = tab
indent_size = 4

[*.yml]
indent_size = 2

[*.yaml]
[*.{yml,yaml}]
indent_size = 2

[*.nix]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/call.deploy-hosted-service-subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -101,4 +101,4 @@ jobs:
run: ./tasks/deploy-to-hosted-service-network.sh ${{ inputs.release_branch }} ${{ inputs.network }}
working-directory: ${{ env.subgraph-working-directory }}
env:
THE_GRAPH_ACCESS_TOKEN: ${{ secrets.THE_GRAPH_ACCESS_TOKEN }}
THE_GRAPH_ACCESS_TOKEN: ${{ secrets.THE_GRAPH_ACCESS_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/call.test-automation-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:

strategy:
matrix:
node-version: [ 16, 18 ]
node-version: [18, 20]

defaults:
run:
shell: nix develop .#ci-node${{ matrix.node-version }} -c bash {0}
shell: nix develop .#ci-node${{ matrix.node-version }} -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand All @@ -33,11 +33,11 @@ jobs:
- name: Test automation-contracts-scheduler
run: |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC_PATH" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC" >> $GITHUB_ENV
yarn workspace scheduler test
- name: Test automation-contracts-autowrap
run: |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC_PATH" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC" >> $GITHUB_ENV
yarn workspace autowrap test
110 changes: 110 additions & 0 deletions .github/workflows/call.test-ethereum-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Reusable Workflow | Test Ethereum Contracts

on:
workflow_call:
inputs:
run-coverage-tests:
required: true
type: boolean

jobs:
# Ahhhhhhhhhh, it is silly, but the only way to preparing conditional matrix.
# Ref: https://stackoverflow.com/questions/65384420/how-do-i-make-a-github-action-matrix-element-conditional
matrix-prep:
name: Preparing Conditional Strategy Matrix

runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- id: set-matrix
run: |
if [ "${{ inputs.run-coverage-tests }}" == "true" ];then
echo "matrix={\"node-version\": [20]}" >> "$GITHUB_OUTPUT"
else
echo "matrix={\"node-version\": [18, 20]}" >> "$GITHUB_OUTPUT"
fi
test-ethereum-contracts:
name: Test ethereum-contracts

needs: [matrix-prep]

runs-on: ubuntu-latest

strategy:
matrix: ${{ fromJson(needs.matrix-prep.outputs.matrix) }}

defaults:
run:
shell: nix develop .#ci-node${{ matrix.node-version }} -c bash -xe {0}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: cachix/install-nix-action@v19
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Initialize devShell
run: |
node --version
yarn --version
solc --version
- name: Yarn Install
run: |
yarn install --frozen-lockfile
npx tsc --version
npx hardhat --version
- name: Lint and build
run: |
yarn lint
yarn build
########################################
## Test Suite
########################################
- name: Run test suite
if: inputs.run-coverage-tests == false
run: |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC" >> $GITHUB_ENV
yarn test
cat testing-benchmark.json
working-directory: ./packages/ethereum-contracts
env:
# NOTE: This is currently unset and fork tests are not being run
POLYGON_MAINNET_ARCHIVE_PROVIDER_URL: ${{ secrets.POLYGON_MAINNET_ARCHIVE_PROVIDER_URL }}

########################################
## Coverage Test
########################################
- name: Run coverage test
if: inputs.run-coverage-tests == true
run: |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC" >> $GITHUB_ENV
yarn test-coverage
working-directory: ./packages/ethereum-contracts

- name: Clean up and merge coverage artifacts
if: inputs.run-coverage-tests == true
run: ./tasks/coverage-cleanup.sh
working-directory: ./packages/ethereum-contracts

- name: Create coverage artifact
if: inputs.run-coverage-tests == true
uses: actions/upload-artifact@v3
with:
name: ethereum-contracts-coverage
path: |
packages/ethereum-contracts/coverage/
4 changes: 2 additions & 2 deletions .github/workflows/call.test-hot-fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

defaults:
run:
shell: nix develop .#ci-hot-fuzz -c bash {0}
shell: nix develop .#ci-hot-fuzz -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand All @@ -24,7 +24,7 @@ jobs:
run: |
set -xe
slither --version
echidna-test --version
echidna --version
- name: Run Yarn Install
run: yarn install
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/call.test-local-subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand All @@ -19,8 +19,17 @@ jobs:
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Initialize devShell
run: |
set -ex
node --version
yarn --version
- name: "Install dependencies"
run: yarn install --frozen-lockfile
run: |
set -ex
yarn install --frozen-lockfile
npx tsc --version
- name: "Build contracts"
run: yarn build
Expand All @@ -41,7 +50,7 @@ jobs:

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -87,4 +96,4 @@ jobs:

- name: "Run subgraph integration test suite"
run: yarn test --network localhost
working-directory: ${{ env.subgraph-working-directory }}
working-directory: ${{ env.subgraph-working-directory }}
6 changes: 3 additions & 3 deletions .github/workflows/call.test-sdk-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:

- name: "Build and deploy local subgraph"
run: |
yarn build-and-deploy-local
yarn build-and-deploy-local
# artificial slow down to give the subgraph time to sync
sleep 30
working-directory: ${{ env.subgraph-working-directory }}
Expand Down Expand Up @@ -103,4 +103,4 @@ jobs:
with:
name: sdk-core-coverage
path: |
packages/sdk-core/coverage/
packages/sdk-core/coverage/
6 changes: 3 additions & 3 deletions .github/workflows/call.test-solidity-semantic-money.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

defaults:
run:
shell: nix develop . -c bash {0}
shell: nix develop . -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand All @@ -32,7 +32,7 @@ jobs:
run: |
cd packages/solidity-semantic-money
# use native compiler provided through the nix devShell
echo "FOUNDRY_SOLC_VERSION=$SOLC_PATH" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC" >> $GITHUB_ENV
make build-src test-all
env:
FOUNDRY_FUZZ_RUNS: 4200 # yea, baby
FOUNDRY_FUZZ_RUNS: 4200 # yea, baby
10 changes: 5 additions & 5 deletions .github/workflows/call.test-spec-haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
strategy:
matrix:
include:
- compiler-name: ghc-9.2.5
dev-shell-type: ci-spec-ghc925
- compiler-name: ghc-9.4.4
dev-shell-type: ci-spec-ghc944
- compiler-name: ghc-9.2
dev-shell-type: ci-spec-ghc92
- compiler-name: ghc-9.4
dev-shell-type: ci-spec-ghc94
fail-fast: false

defaults:
run:
shell: nix develop .#${{ matrix.dev-shell-type }} -c bash {0}
shell: nix develop .#${{ matrix.dev-shell-type }} -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop -c bash -xe {0}

steps:
- uses: actions/checkout@v3
Expand All @@ -52,7 +52,7 @@ jobs:
run: |
./tasks/startHardhatNode.sh start
working-directory: ${{ env.sdk-core-working-directory }}

- name: "Build SDK-Core"
# build sdk-core because of auto linking to dependency
run: yarn build
Expand Down Expand Up @@ -92,4 +92,4 @@ jobs:

- name: "Stop Hardhat node"
run: ./tasks/startHardhatNode.sh stop
working-directory: ${{ env.sdk-core-working-directory }}
working-directory: ${{ env.sdk-core-working-directory }}
42 changes: 42 additions & 0 deletions .github/workflows/call.upload-coverage-reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Reusable Workflow | Upload Coverage Reports

on:
workflow_call:


jobs:
upload-coverage-reports:
name: Upload coverage reports

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Download ethereum-contracts-coverage
uses: actions/download-artifact@v3
with:
name: ethereum-contracts-coverage
path: packages/ethereum-contracts/coverage
- name: Upload ethereum-contracts-coverage to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: packages/ethereum-contracts/coverage/lcov.info
name: ethereum-contracts-coverage
flags: ethereum-contracts
fail_ci_if_error: true

- name: Download sdk-core-coverage
uses: actions/download-artifact@v3
with:
name: sdk-core-coverage
path: packages/sdk-core/coverage
- name: Upload sdk-core-coverage to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: packages/sdk-core/coverage/lcov.info
name: sdk-core-coverage
flags: sdk-core
fail_ci_if_error: true
7 changes: 5 additions & 2 deletions .github/workflows/cd.feature.create-pr-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ jobs:

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop -c bash -xe {0}

if: ${{ !github.event.pull_request.draft }}
# BUG related to lerna dependency: https://github.com/nrwl/nx/issues/18247
# Disabling for now:
if: false
# if: ${{ !github.event.pull_request.draft }}

steps:
- uses: actions/checkout@v3
Expand Down
Loading

0 comments on commit 6f34137

Please sign in to comment.