Skip to content

Commit 7d9e178

Browse files
Le-CaignecgfournierProTartanLeGrandzguesmi
authored
feat: Setup agnostic test stack (#38)
* Add Docker support and environment setup for poco-subgraph - Introduced .dockerignore and Dockerfile for containerization. - Updated networks.json with new addresses and start blocks. - Enhanced package.json with new scripts for cleaning and managing the build process. - Created .gitignore for test-stack to exclude .env files. - Added docker-compose.yml to define services for the test environment. - Implemented prepare-test-env.js for dynamic environment variable generation. - Removed tsconfig.json as it is no longer needed. * Update CHANGELOG and README with Docker subgraph deployer details * Fix Docker run command to use correct image name for poco-subgraph-deployer * Add PR number in changelog * Remove unused 'fork-test' network configuration and update Docker Compose to use dynamic NETWORK_NAME for Ethereum service * feat: add typechain generation script and update dependencies - Added a new script to generate TypeChain types for ethers-v6 in package.json. - Updated the start-test-stack script to ensure proper environment setup. - Modified the itest script to include NETWORK_NAME in the environment. - Removed unused callHandlers from subgraph.yaml. - Enhanced docker-compose.yml to include a stack-ready service for better orchestration. - Updated prepare-test-env.js to conditionally update networks.json based on NETWORK_NAME. - Introduced tsconfig.json for TypeScript configuration with strict settings. * docs: update CHANGELOG to include README section for Docker-based subgraph deployer * chore: update .gitignore to include test-stack/.env and remove redundant .gitignore file * test: update integration test description to reflect app indexing functionality * refactor: restructure prepare-test-env.js to improve block number fetching and environment file creation * fix: simplify itest script by removing DEBUG flag * fix: update start-test-stack script to use export for NETWORK_NAME * Update test-stack/prepare-test-env.js Co-authored-by: gfournieriExec <[email protected]> * refactor: streamline package.json scripts by removing redundant clean and codegen commands * refactor: update build and test scripts for consistency and clarity * fix: simplify remove drone logic * fix: ensure typechain generation runs before starting test stack * refactor: simplify README instructions for local development and testing * fix: reorder unit test execution in CI workflow and update README for build instructions * Remove unused files (#42) * Remove obsolete Docker configurations, environment files, and subgraph definitions for bellecour, test, and viviani. Refactor unit tests for IexecCategoryManager and IexecPoco, consolidating mock utilities and event parameter builders into a unified structure. * refactor:github-action-ci (#43) * chore: update GitHub workflows for coverage, deployment, and testing * refactor: add formatting scripts and .prettierignore for code consistency * chore: update dependencies in package.json * fix: correct paths in .gitignore for test artifacts * feature/migrate-integration-tests (#44) * Feature/remove dead handler (#45) * fix: Fix Subgraph deployment (#47) * refactor: update CI workflow to include health checks and integration tests, remove obsolete Jenkinsfile * fix: update fork URL and block number retrieval in CI workflow * fix: update command options and environment variable retrieval in CI workflow * fix: correct health check options and update fork URL retrieval in CI workflow * fix: update IPFS image and health check commands in CI workflow * fix: update CI workflow to include genesis block retrieval and health checks for Graph Node * fix: update IPFS image to use kubo version in docker-compose * fix: retrieve fork URL and block number * fix: remove blockchain-fork service configuration from CI workflow * fix: update fetch block number to use static values and add IPFS readiness check * fix: remove code generation step from README * fix: remove unused services and streamline CI workflow * fix: update FORK_URL to use the correct endpoint for integration tests * fix: uncomment steps for installing dependencies, checking format, building, and running unit tests in CI workflow * fix: uncomment steps for preparing local stack environment and update FORK_BLOCK in test environment setup * fix: update fetch block step to source environment variables and use dynamic values for FORK_URL and FORK_BLOCK * fix: add NETWORK_NAME environment variable to prepare local stack environment step * fix: update fetch block step to source the correct environment file * fix: remove .idea directory from .gitignore * fix: reorder build step to occur before running unit tests * fix: reorder steps to run unit tests after build in CI workflow * fix: move NETWORK_NAME environment variable to the job level in CI workflow * Update test-stack/prepare-test-env.ts Co-authored-by: Zied Guesmi <[email protected]> * fix: update changelog for integration tests migration to GitHub Actions * fix: streamline test stack preparation in CI workflow (#46) * fix: remove NETWORK_NAME environment variable from job level in CI workflow * fix: update .env generation message in prepare-test-env script * fix: update integration test structure and add .env.template file * fix: add missing network configurations for avalancheFuji and arbitrumSepolia * fix: add Arbitrum & Avalanche network to changelog * fix: add dotenv and zod to package.json and package-lock.json; create env.ts for environment variable validation * fix: update test:unit script to include 'unit' argument for clarity * fix: update startBlock values and rename avalancheFuji to fuji in networks.json * feat: add Protocol entity to Core data source in subgraph.yaml * fix: update test:e2e script to specify test file pattern * fix: downgrade @graphprotocol/graph-ts to version 0.35.1 in package.json and package-lock.json * feat: add dotenv-cli dependency and update build scripts to use dotenv --------- Co-authored-by: Ugo Mignon <[email protected]> Co-authored-by: Zied Guesmi <[email protected]> --------- Co-authored-by: gfournieriExec <[email protected]> Co-authored-by: Ugo Mignon <[email protected]> Co-authored-by: Zied Guesmi <[email protected]>
1 parent 721f751 commit 7d9e178

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4907
-4601
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
3+
# generated files
4+
build
5+
generated
6+
7+
# test files
8+
test-stack

.env.template

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# The name of the network (e.g., mainnet, arbitrum, etc.)
2+
NETWORK_NAME=...
3+
4+
# The URL of the Graph Node endpoint for self-hosted Graph Node
5+
GRAPHNODE_URL=...
6+
7+
# The URL of the IPFS endpoint for self-hosted IPFS
8+
IPFS_URL=...
9+
10+
# The version label for the deployment (e.g., v1.0.0)
11+
VERSION_LABEL=...

.github/workflows/coverage.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v4
13+
1314
- name: Init
1415
run: npm ci
16+
1517
- name: Run Coverage
1618
run: (npm run coverage 2>&1) | tee /tmp/coverage.out | cat
19+
1720
- name: Extract coverage
1821
run: echo "COVERAGE=$(cat /tmp/coverage.out | grep "Global test coverage")" >> $GITHUB_ENV
22+
1923
- name: Display coverage in Github PR checks
2024
# See https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run
2125
# and https://www.kenmuse.com/blog/creating-github-checks/
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy Subgraph
2+
3+
on:
4+
workflow_dispatch: # Triggered manually but we can also trigger with an release event
5+
inputs:
6+
environment:
7+
description: 'Deployment environment (must match a GitHub Environment name)'
8+
required: true
9+
default: staging
10+
type: choice
11+
options:
12+
- staging
13+
- production
14+
- tmp
15+
# Add new networks when needed. Do not forget to add necessary data in the networks.json file.
16+
networkName:
17+
description: 'Network Name'
18+
required: false
19+
default: bellecour
20+
type: choice
21+
options:
22+
- bellecour
23+
versionLabel:
24+
description: 'Version Label for Subgraph Deployment'
25+
required: false
26+
default: develop
27+
type: string
28+
29+
jobs:
30+
deploy:
31+
runs-on: ubuntu-latest
32+
# Associate the job with a GitHub Environment which has pre-defined variables and secrets.
33+
environment: ${{ github.event.inputs.environment }}
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: '20'
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Deploy Subgraph
47+
env:
48+
NETWORK_NAME: ${{ github.event.inputs.networkName }}
49+
VERSION_LABEL: ${{ github.event.inputs.versionLabel }}
50+
GRAPHNODE_URL: ${{ vars.GRAPHNODE_URL }}
51+
IPFS_URL: ${{ vars.IPFS_URL }}
52+
DEPLOY_ENV: ${{ vars.ENV_NAME }}
53+
run: |
54+
echo "Starting deployment with the following parameters:"
55+
echo " Network Name: $NETWORK_NAME"
56+
echo " Version Label: $VERSION_LABEL"
57+
echo " DEPLOY_ENV: $DEPLOY_ENV"
58+
echo " GRAPHNODE_URL: $GRAPHNODE_URL"
59+
echo " IPFS_URL: $IPFS_URL"
60+
npm run all
61+
shell: bash

.github/workflows/docker-push.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Push Subgraph Deployer Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*' # Trigger on tag push
7+
workflow_dispatch:
8+
9+
jobs:
10+
# Need to compute the tag based on the event type
11+
compute-tag:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
computed_tag: ${{ steps.set_tag.outputs.computed_tag }}
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set image tag
20+
id: set_tag
21+
run: |
22+
set -e
23+
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
24+
latest_tag=$(git describe --tags --abbrev=0)
25+
echo "computed_tag=${latest_tag}+dev+${GITHUB_SHA}" >> $GITHUB_OUTPUT
26+
else
27+
echo "computed_tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
28+
29+
build:
30+
needs: compute-tag
31+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
32+
with:
33+
image-name: 'iexechub/voucher-subgraph-deployer'
34+
image-tag: ${{ needs.compute-tag.outputs.computed_tag }}
35+
security-scan: false
36+
hadolint: false
37+
push: true
38+
secrets:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_PAT }}

.github/workflows/docker-test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Test Docker Image
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build-test:
7+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
8+
with:
9+
image-name: 'iexechub/voucher-subgraph-deployer'
10+
image-tag: ${{ github.sha }}
11+
push: false
12+
security-scan: true

.github/workflows/main.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,47 @@
1+
name: default
2+
13
on:
24
push:
35
branches:
46
- feature/*
57
- bugfix/*
6-
- develop
78
- release/*
89
- hotfix/*
10+
- develop
911
- main
1012

13+
concurrency:
14+
group: ci-${{ github.head_ref }}
15+
cancel-in-progress: true
16+
1117
jobs:
12-
test:
13-
runs-on: ubuntu-22.04 # For 24.04+, see https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
18+
build-and-test:
19+
runs-on: ubuntu-latest
20+
1421
steps:
1522
- name: Checkout
1623
uses: actions/checkout@v4
17-
- name: Init
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
cache: 'npm'
30+
31+
- name: Install dependencies
1832
run: npm ci
19-
- name: Run unit tests
20-
run: npm run test
21-
- name: Test build
33+
34+
- name: Check Format
35+
run: npm run check-format
36+
37+
- name: Build
2238
run: npm run build
23-
# See Jenkinsfile-itest for "Run integration tests" step
39+
40+
- name: Run unit tests
41+
run: npm run test:unit
42+
43+
- name: Prepare test stack
44+
run: npm run start-test-stack
45+
46+
- name: Run integration tests
47+
run: npm run test:e2e

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ node_modules
22
build
33
generated
44
yarn.lock
5-
test/.bin
65
subgraph.test.yaml
6+
test-stack/.env
7+
tests/.bin
8+
tests/.latest.json
9+
.env

.mocharc.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"extension": ["ts"],
3-
"spec": "itest/**/*.ts",
43
"require": ["ts-node/register"],
5-
"timeout": 1000000
4+
"timeout": 1000000,
5+
"node-option": [
6+
"experimental-specifier-resolution=node",
7+
"loader=ts-node/esm"
8+
]
69
}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.18

0 commit comments

Comments
 (0)