-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from iExecBlockchainComputing/release/1.1.0
Release v1.1.0 - Support deal sponsor
- Loading branch information
Showing
32 changed files
with
4,505 additions
and
6,635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
|
||
jobs: | ||
coverage: | ||
runs-on: ubuntu-latest | ||
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/ | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | # TODO: Set "failure" conclusion if coverage is too low | ||
curl -L -X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GH_TOKEN"\ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${{ github.repository }}/check-runs \ | ||
-d '{"name":"Coverage ratio", "head_sha":"${{ github.event.pull_request.head.sha }}", "status":"completed", "conclusion":"success", "output":{"title":"${{env.COVERAGE}}", "summary":""}}' | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
on: | ||
push: | ||
branches: | ||
- feature/* | ||
- bugfix/* | ||
- develop | ||
- release/* | ||
- hotfix/* | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 # For 24.04+, see https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Init | ||
run: npm ci | ||
- name: Run unit tests | ||
run: npm run test | ||
- name: Test build | ||
run: npm run build | ||
# See Jenkinsfile-itest for "Run integration tests" step |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ node_modules | |
build | ||
generated | ||
yarn.lock | ||
test/.bin | ||
subgraph.yaml | ||
subgraph.test.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extension": ["ts"], | ||
"spec": "itest/**/*.ts", | ||
"require": ["ts-node/register"], | ||
"timeout": 1000000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"tabWidth": 4, | ||
"trailingComma": "all", | ||
"endOfLine": "auto", | ||
"plugins": [ | ||
"prettier-plugin-organize-imports" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
node('docker') { | ||
stage('Clone') { | ||
cleanWs() | ||
checkoutInfo = checkout(scm) | ||
echo "git checkout: ${checkoutInfo}" | ||
} | ||
stage('Pull images') { | ||
withCredentials([ | ||
usernamePassword(credentialsId: 'docker-regis', | ||
usernameVariable: 'username', passwordVariable: 'password') | ||
]) { | ||
def registry = 'docker-regis.iex.ec' | ||
try { | ||
sh "echo -n '${password}' | docker login --username '${username}' --password-stdin ${registry}" | ||
sh 'cd docker/test/ && docker compose pull chain' | ||
} finally { | ||
sh "docker logout ${registry}" | ||
} | ||
} | ||
} | ||
docker.image('node:22-alpine') | ||
.inside('-v /var/run/docker.sock:/var/run/docker.sock --network=host --user=root') { | ||
stage('Init') { | ||
sh 'apk add docker docker-compose' // TODO: Use already built image for a faster job execution | ||
sh 'npm ci' | ||
} | ||
stage('Integration tests') { | ||
sh 'npm run itest' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library | ||
|
||
@Library('global-jenkins-library@2.7.7') _ | ||
@Library('global-jenkins-library@2.8.1') _ | ||
deploySubGraph( | ||
targetRemoteHost : 'azubgrpbp-thegraph-bellecour.public.az2.internal', | ||
targetRemoteHostGraphNode : 'azubgrpbp-thegraph.public.az2.internal', | ||
targetRemoteHostIPFS : 'ipfs-upload.v8-bellecour.iex.ec', | ||
subgraphFolder: './', | ||
subgraphFilename: 'subgraph.bellecour.yaml', | ||
subgraphVersionLabel: 'v1.0.0-rc.1', | ||
subgraphVersionLabel: 'v1.1.0', | ||
subgraphLabel: 'bellecour/poco-v5' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library | ||
|
||
@Library('[email protected]') _ | ||
deploySubGraph( | ||
targetRemoteHostGraphNode : 'azubgrpbx-thegraph-staging.public.az2.internal', | ||
targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec', | ||
subgraphFolder: './', | ||
subgraphFilename: 'subgraph.bellecour.yaml', | ||
subgraphVersionLabel: 'v1.1.0', | ||
subgraphLabel: 'bellecour/poco-v5' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM node:22 | ||
WORKDIR /iexec-poco-subgraph | ||
COPY package*.json . | ||
RUN npm ci | ||
COPY schema.graphql . | ||
COPY subgraph.template.yaml . | ||
COPY networks.json . | ||
COPY src src | ||
ENTRYPOINT [ "npm", "run", "deploy:all" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
DATA=/home/tmp/graph-test | ||
DB_USER=graphnode | ||
DB_PASSWORD=somerandompasswordthatishardtoguess | ||
DB_NAME=graphnode | ||
DB_NAME=graphnode-db | ||
NETWORK_NAME=test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,63 @@ | ||
version: "3" | ||
|
||
networks: | ||
thegraph: | ||
blockchain: | ||
|
||
services: | ||
chain: | ||
image: "iexechub/poco-chaintest:5.3.0-token-parity" | ||
image: docker-regis.iex.ec/poco-chain:1.0.0-poco-v5.5.0-voucher-v1.0.0-nethermind | ||
restart: unless-stopped | ||
networks: | ||
- blockchain | ||
expose: | ||
- 8545 | ||
- 8546 | ||
ports: | ||
- 8545:8545 | ||
- 8546:8546 | ||
# - 8546:8546 # port (not required for integration tests) fails to open on CI | ||
|
||
ipfs: | ||
image: ipfs/go-ipfs:v0.10.0 | ||
restart: unless-stopped | ||
networks: | ||
- thegraph | ||
image: ipfs/go-ipfs:v0.22.0 | ||
ports: | ||
- 8080:8080 | ||
- 5001:5001 | ||
volumes: | ||
- ${DATA}/ipfs:/data/ipfs | ||
|
||
postgres: | ||
image: postgres:12 | ||
graphnode-postgres: | ||
image: postgres:16.4 | ||
restart: unless-stopped | ||
networks: | ||
- thegraph | ||
command: | ||
- "postgres" | ||
- "-cshared_preload_libraries=pg_stat_statements" | ||
ports: | ||
- 5432:5432 | ||
expose: | ||
- 5432 | ||
environment: | ||
POSTGRES_USER: "${DB_USER}" | ||
POSTGRES_PASSWORD: "${DB_PASSWORD}" | ||
POSTGRES_DB: "${DB_NAME}" | ||
POSTGRES_USER: ${DB_USER} | ||
POSTGRES_PASSWORD: ${DB_PASSWORD} | ||
POSTGRES_DB: ${DB_NAME} | ||
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" | ||
|
||
graphnode: | ||
image: graphprotocol/graph-node:v0.27.0 | ||
image: graphprotocol/graph-node:v0.35.1 | ||
restart: unless-stopped | ||
networks: | ||
- blockchain | ||
- thegraph | ||
depends_on: | ||
- ipfs | ||
- postgres | ||
- chain | ||
ports: | ||
- 8000:8000 # http | ||
- 8001:8001 # ws | ||
- 8020:8020 # deploy | ||
- 8030:8030 # monitoring | ||
- 8040:8040 # prometeus | ||
- 8000:8000 # GraphQL HTTP | ||
# - 8001:8001 # GraphQL WS | ||
- 8020:8020 # admin RPC | ||
# - 8040:8040 # metrics | ||
environment: | ||
postgres_host: graphnode-postgres | ||
postgres_port: 5432 | ||
postgres_user: ${DB_USER} | ||
postgres_pass: ${DB_PASSWORD} | ||
postgres_db: ${DB_NAME} | ||
ipfs: ipfs:5001 | ||
ethereum: ${NETWORK_NAME}:http://chain:8545 | ||
healthcheck: | ||
test: netcat -w 1 0.0.0.0 8020 | ||
interval: 10s | ||
timeout: 5s | ||
retries: 10 | ||
start_period: 30s | ||
|
||
poco-subgraph-deployer: | ||
build: | ||
context: ../.. | ||
dockerfile: docker/Dockerfile | ||
environment: | ||
RUST_BACKTRACE: 1 | ||
postgres_host: postgres | ||
postgres_user: "${DB_USER}" | ||
postgres_pass: "${DB_PASSWORD}" | ||
postgres_db: "${DB_NAME}" | ||
ipfs: "ipfs:5001" | ||
ethereum: "test:http://chain:8545" | ||
GRAPH_NODE_ID: "graphnode_id" | ||
GRAPHNODE_URL: http://graphnode:8020 | ||
IPFS_URL: http://ipfs:5001 | ||
NETWORK_NAME: ${NETWORK_NAME} | ||
depends_on: | ||
graphnode: | ||
condition: service_healthy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { ApolloClient, gql, InMemoryCache } from '@apollo/client'; | ||
import { equal } from 'assert'; | ||
import { DockerComposeEnvironment, Wait } from 'testcontainers'; | ||
|
||
const SECONDS = 1000; | ||
const MINUTES = 60 * SECONDS; | ||
const APIURL = 'http://localhost:8000/subgraphs/name/test/poco'; | ||
const client = new ApolloClient({ | ||
uri: APIURL, | ||
cache: new InMemoryCache(), | ||
}); | ||
|
||
describe('Integration tests', () => { | ||
/** | ||
* Services are started only once before running all tests to get a decent test | ||
* suite duration with multiple tests. Please switch to `beforeEach` if necessary. | ||
* Shutdown of services is handled by `testcontainers` framework. | ||
*/ | ||
before(async () => { | ||
console.log('Starting services..'); | ||
const environment = new DockerComposeEnvironment('docker/test/', 'docker-compose.yml') | ||
.withStartupTimeout(5 * MINUTES) | ||
.withWaitStrategy( | ||
'poco-subgraph-deployer-1', | ||
Wait.forLogMessage( | ||
'Deployed to http://graphnode:8000/subgraphs/name/test/poco/graphql', | ||
), | ||
); | ||
await environment.up(); | ||
const secondsToWait = 10; | ||
console.log( | ||
`Waiting ${secondsToWait}s for graphnode to ingest a few blocks before querying it..`, | ||
); | ||
await new Promise((resolve) => { | ||
return setTimeout(resolve, secondsToWait * SECONDS); | ||
}); | ||
}); | ||
|
||
it('should get protocol', async () => { | ||
const result = await client.query({ | ||
query: gql(` | ||
query { | ||
protocol(id: "iExec") { | ||
id | ||
tvl | ||
} | ||
} | ||
`), | ||
}); | ||
const protocol = result.data.protocol; | ||
equal(protocol.id, 'iExec'); | ||
equal(protocol.tvl, '0.02025'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
testsFolder: test | ||
manifestPath: subgraph.template.yaml |
Oops, something went wrong.