-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Setup agnostic test stack #38
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
Changes from all commits
d422d2d
d94df29
1f06f27
5965823
6208908
bf23446
bd7e419
37772e2
0650896
927a833
98a0dfe
625d111
fceadbd
9d7495b
2b6587b
26b53fa
b43fd3a
fa14ee1
9b7d648
ea4c86d
9ac3dd0
8703e18
4e4b436
876ea82
8c8a1f1
e28dafd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules | ||
|
||
# generated files | ||
build | ||
generated | ||
|
||
# test files | ||
test-stack |
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=... |
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 |
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 }} |
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 |
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 |
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" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.18 |
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/** |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
FROM node:22 | ||
# iexec-poco-subgraph deployer | ||
|
||
FROM node:20 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the difference with ./docker/Dockerfile There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we should remove the one in ./docker/Dockerfile ? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not use node 22 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All our repositories — voucher-subgraph, voucher-contract — are using Node 20. |
||
|
||
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" ] |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.