Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d422d2d
Add Docker support and environment setup for poco-subgraph
Le-Caignec Apr 4, 2025
d94df29
Update CHANGELOG and README with Docker subgraph deployer details
Le-Caignec Apr 4, 2025
1f06f27
Fix Docker run command to use correct image name for poco-subgraph-de…
Le-Caignec Apr 4, 2025
5965823
Add PR number in changelog
Le-Caignec Apr 4, 2025
6208908
Remove unused 'fork-test' network configuration and update Docker Com…
Le-Caignec Apr 7, 2025
bf23446
feat: add typechain generation script and update dependencies
Le-Caignec Apr 11, 2025
bd7e419
docs: update CHANGELOG to include README section for Docker-based sub…
Le-Caignec Apr 15, 2025
37772e2
chore: update .gitignore to include test-stack/.env and remove redund…
Le-Caignec Apr 15, 2025
0650896
test: update integration test description to reflect app indexing fun…
Le-Caignec Apr 15, 2025
927a833
refactor: restructure prepare-test-env.js to improve block number fet…
Le-Caignec Apr 15, 2025
98a0dfe
fix: simplify itest script by removing DEBUG flag
Le-Caignec Apr 15, 2025
625d111
fix: update start-test-stack script to use export for NETWORK_NAME
Le-Caignec Apr 15, 2025
fceadbd
Update test-stack/prepare-test-env.js
Le-Caignec Apr 17, 2025
9d7495b
refactor: streamline package.json scripts by removing redundant clean…
Le-Caignec Apr 17, 2025
2b6587b
Merge branch 'feature/setup-agnostique-test-stack-based-on-fork' of h…
Le-Caignec Apr 17, 2025
26b53fa
refactor: update build and test scripts for consistency and clarity
Le-Caignec Apr 17, 2025
b43fd3a
fix: simplify remove drone logic
Le-Caignec Apr 17, 2025
fa14ee1
fix: ensure typechain generation runs before starting test stack
Le-Caignec Apr 17, 2025
9b7d648
refactor: simplify README instructions for local development and testing
Le-Caignec Apr 22, 2025
ea4c86d
fix: reorder unit test execution in CI workflow and update README for…
Le-Caignec Apr 22, 2025
9ac3dd0
Remove unused files (#42)
Le-Caignec Apr 22, 2025
8703e18
refactor:github-action-ci (#43)
Le-Caignec Apr 23, 2025
4e4b436
fix: correct paths in .gitignore for test artifacts
Le-Caignec Apr 23, 2025
876ea82
feature/migrate-integration-tests (#44)
Le-Caignec Apr 25, 2025
8c8a1f1
Feature/remove dead handler (#45)
Le-Caignec Apr 25, 2025
e28dafd
fix: Fix Subgraph deployment (#47)
Le-Caignec Apr 29, 2025
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules

# generated files
build
generated

# test files
test-stack
11 changes: 11 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# The name of the network (e.g., mainnet, arbitrum, etc.)
NETWORK_NAME=...

# The URL of the Graph Node endpoint for self-hosted Graph Node
GRAPHNODE_URL=...

# The URL of the IPFS endpoint for self-hosted IPFS
IPFS_URL=...

# The version label for the deployment (e.g., v1.0.0)
VERSION_LABEL=...
4 changes: 4 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Init
run: npm ci

- name: Run Coverage
run: (npm run coverage 2>&1) | tee /tmp/coverage.out | cat

- name: Extract coverage
run: echo "COVERAGE=$(cat /tmp/coverage.out | grep "Global test coverage")" >> $GITHUB_ENV

- name: Display coverage in Github PR checks
# See https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run
# and https://www.kenmuse.com/blog/creating-github-checks/
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/deploy-subgraph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy Subgraph

on:
workflow_dispatch: # Triggered manually but we can also trigger with an release event
inputs:
environment:
description: 'Deployment environment (must match a GitHub Environment name)'
required: true
default: staging
type: choice
options:
- staging
- production
- tmp
# Add new networks when needed. Do not forget to add necessary data in the networks.json file.
networkName:
description: 'Network Name'
required: false
default: bellecour
type: choice
options:
- bellecour
versionLabel:
description: 'Version Label for Subgraph Deployment'
required: false
default: develop
type: string

jobs:
deploy:
runs-on: ubuntu-latest
# Associate the job with a GitHub Environment which has pre-defined variables and secrets.
environment: ${{ github.event.inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Deploy Subgraph
env:
NETWORK_NAME: ${{ github.event.inputs.networkName }}
VERSION_LABEL: ${{ github.event.inputs.versionLabel }}
GRAPHNODE_URL: ${{ vars.GRAPHNODE_URL }}
IPFS_URL: ${{ vars.IPFS_URL }}
DEPLOY_ENV: ${{ vars.ENV_NAME }}
run: |
echo "Starting deployment with the following parameters:"
echo " Network Name: $NETWORK_NAME"
echo " Version Label: $VERSION_LABEL"
echo " DEPLOY_ENV: $DEPLOY_ENV"
echo " GRAPHNODE_URL: $GRAPHNODE_URL"
echo " IPFS_URL: $IPFS_URL"
npm run all
shell: bash
40 changes: 40 additions & 0 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Push Subgraph Deployer Docker Image

on:
push:
tags:
- '*' # Trigger on tag push
workflow_dispatch:

jobs:
# Need to compute the tag based on the event type
compute-tag:
runs-on: ubuntu-latest
outputs:
computed_tag: ${{ steps.set_tag.outputs.computed_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set image tag
id: set_tag
run: |
set -e
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
latest_tag=$(git describe --tags --abbrev=0)
echo "computed_tag=${latest_tag}+dev+${GITHUB_SHA}" >> $GITHUB_OUTPUT
else
echo "computed_tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT

build:
needs: compute-tag
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@docker-build-v2.0.0
with:
image-name: 'iexechub/voucher-subgraph-deployer'
image-tag: ${{ needs.compute-tag.outputs.computed_tag }}
security-scan: false
hadolint: false
push: true
secrets:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PAT }}
12 changes: 12 additions & 0 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Test Docker Image

on: [pull_request]

jobs:
build-test:
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@docker-build-v2.0.0
with:
image-name: 'iexechub/voucher-subgraph-deployer'
image-tag: ${{ github.sha }}
push: false
security-scan: true
40 changes: 32 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,47 @@
name: default

on:
push:
branches:
- feature/*
- bugfix/*
- develop
- release/*
- hotfix/*
- develop
- main

concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-22.04 # For 24.04+, see https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Init

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test
- name: Test build

- name: Check Format
run: npm run check-format

- name: Build
run: npm run build
# See Jenkinsfile-itest for "Run integration tests" step

- name: Run unit tests
run: npm run test:unit

- name: Prepare test stack
run: npm run start-test-stack

- name: Run integration tests
run: npm run test:e2e
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ node_modules
build
generated
yarn.lock
test/.bin
subgraph.test.yaml
test-stack/.env
tests/.bin
tests/.latest.json
.env
7 changes: 5 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extension": ["ts"],
"spec": "itest/**/*.ts",
"require": ["ts-node/register"],
"timeout": 1000000
"timeout": 1000000,
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
]
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.18
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.graphql
*.md
*.yml

##TODO: To remove and format this folder in an other PR
src/**
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Changelog

## vNEXT

- Add Arbitrum & Avalanche networks. (#47)
- Migrate integration tests from Jenkins to GitHub Actions. (#44)
- Remove unused files to streamline the repository. (#42)
- Rewrite Jenkins CI for future migration (#36, #37)
- Add a modern test stack, agnostic to the forked network. (#38)
- Add a section in the README to explain how to use the Docker-based subgraph deployer. (#38)

## v1.1.0 - Support deal sponsor

- Add `sponsor` to `deal`. (#31)
- Update deployment hosts:
- production (#30)
- staging (#29)
- production (#30)
- staging (#29)
- Display coverage in Github PR checks. (#26)
- Add integration test suite. (#21)
- Add unit test suite. (#20)
Expand Down
14 changes: 10 additions & 4 deletions docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
FROM node:22
# iexec-poco-subgraph deployer

FROM node:20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference with ./docker/Dockerfile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s the same. But according to Ugo, it’s better to move this file to root level for the GitHub Action CI. That’s why he also moved it to the root of the voucher subgraph repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a comment at the top of the file to explain why we have both files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we should remove the one in ./docker/Dockerfile ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, as mentioned in the PR description, the Docker folder will be removed in another PR since the new Docker Compose is network-agnostic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use node 22 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All our repositories — voucher-subgraph, voucher-contract — are using Node 20.
I think we should stay consistent. But you’re right, we do need to move to Node 22.
Maybe we can discuss it during our Web3 daily.


WORKDIR /iexec-poco-subgraph

COPY package*.json .
RUN npm ci
COPY schema.graphql .
COPY subgraph.yaml .
COPY networks.json .
COPY src src
ENTRYPOINT [ "npm", "run", "deploy:all" ]
COPY src ./src

RUN npm ci

ENTRYPOINT [ "npm", "run", "all" ]
67 changes: 0 additions & 67 deletions Jenkinsfile

This file was deleted.

31 changes: 0 additions & 31 deletions Jenkinsfile-itest

This file was deleted.

Loading