Skip to content

Commit adc062e

Browse files
Le-CaignecgfournierProTartanLeGrandzguesmi
authored
Develop: move to trunk based developement (#48)
Co-authored-by: gfournieriExec <[email protected]> Co-authored-by: gfournieriExec <[email protected]> Co-authored-by: Ugo Mignon <[email protected]> Co-authored-by: Zied Guesmi <[email protected]>
1 parent d57167b commit adc062e

Some content is hidden

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

60 files changed

+4983
-6109
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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
on:
22
pull_request:
3-
branches:
4-
- develop
5-
- main
63

74
jobs:
85
coverage:
96
runs-on: ubuntu-latest
107
steps:
118
- name: Checkout
129
uses: actions/checkout@v4
10+
1311
- name: Init
1412
run: npm ci
13+
1514
- name: Run Coverage
1615
run: (npm run coverage 2>&1) | tee /tmp/coverage.out | cat
16+
1717
- name: Extract coverage
1818
run: echo "COVERAGE=$(cat /tmp/coverage.out | grep "Global test coverage")" >> $GITHUB_ENV
19+
1920
- name: Display coverage in Github PR checks
2021
# See https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run
2122
# 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 & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
1+
name: default
2+
13
on:
2-
push:
3-
branches:
4-
- feature/*
5-
- bugfix/*
6-
- develop
7-
- release/*
8-
- hotfix/*
9-
- main
4+
pull_request:
5+
6+
concurrency:
7+
group: ci-${{ github.head_ref }}
8+
cancel-in-progress: true
109

1110
jobs:
12-
test:
13-
runs-on: ubuntu-22.04 # For 24.04+, see https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
11+
build-and-test:
12+
runs-on: ubuntu-latest
13+
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17-
- name: Init
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: 'npm'
23+
24+
- name: Install dependencies
1825
run: npm ci
19-
- name: Run unit tests
20-
run: npm run test
21-
- name: Test build
26+
27+
- name: Check Format
28+
run: npm run check-format
29+
30+
- name: Build
2231
run: npm run build
23-
# See Jenkinsfile-itest for "Run integration tests" step
32+
33+
- name: Run unit tests
34+
run: npm run test:unit
35+
36+
- name: Prepare test stack
37+
run: npm run start-test-stack
38+
39+
- name: Run integration tests
40+
run: npm run test:e2e

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ node_modules
22
build
33
generated
44
yarn.lock
5-
test/.bin
6-
subgraph.yaml
75
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)