Skip to content

Commit

Permalink
Merge branch 'master' into zoran/add-labels-deployment-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
zorancv committed Nov 13, 2023
2 parents e451020 + 79703ba commit 753eb36
Show file tree
Hide file tree
Showing 146 changed files with 5,799 additions and 12,280 deletions.
74 changes: 46 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ jobs:
run: sudo ethtool -K eth0 tx off rx off
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Node 20
uses: actions/setup-node@v3
with:
node-version: "20"
cache: yarn
cache-dependency-path: "tests/runner-tests/yarn.lock"

- uses: Swatinem/rust-cache@v2

- name: Install lld
Expand All @@ -92,16 +100,33 @@ jobs:
- name: Run runner tests
id: runner-tests-1
uses: actions-rs/cargo@v1
env:
TESTS_GANACHE_HARD_WAIT_SECONDS: "60"
with:
command: test
args: --verbose --package graph-tests -- --skip parallel_integration_tests
args: --package graph-tests --test runner_tests

integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
timeout-minutes: 60
services:
ipfs:
image: ipfs/go-ipfs:v0.10.0
ports:
- 3001:5001
postgres:
image: postgres
env:
POSTGRES_USER: graph-node
POSTGRES_PASSWORD: let-me-in
POSTGRES_DB: graph-node
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3011:5432
env:
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -D warnings"
steps:
Expand All @@ -112,49 +137,42 @@ jobs:
uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2

- name: Install Node 16
- name: Install Node 20
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "20"
cache: yarn
cache-dependency-path: "tests/integration-tests/yarn.lock"

- name: Install lld and jq
run: sudo apt-get install -y lld jq protobuf-compiler

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Start anvil
run: anvil --gas-limit 100000000000 --base-fee 1 --block-time 2 --port 3021 &

- name: Install graph CLI
run: curl -sSL http://cli.thegraph.com/install.sh | sudo bash

- name: Build graph-node
uses: actions-rs/cargo@v1
with:
command: build
args: --bin graph-node
args: --bin graph-node --test integration_tests

# Integration tests are a bit flaky, running them twice increases the
# chances of one run succeeding.
- name: Run integration tests (round 1)
- name: Run integration tests
id: integration-tests-1
uses: actions-rs/cargo@v1
env:
N_CONCURRENT_TESTS: "4"
TESTS_GANACHE_HARD_WAIT_SECONDS: "30"
# Reduce how long a batch will stick around to avoid timeouts
GRAPH_STORE_WRITE_BATCH_DURATION: 30
with:
command: test
args: --verbose --package graph-tests parallel_integration_tests -- --nocapture
continue-on-error: true
- name: Run integration tests (round 2)
id: integration-tests-2
uses: actions-rs/cargo@v1
if: ${{ steps.integration-tests-1.outcome == 'failure' }}
env:
N_CONCURRENT_TESTS: "4"
TESTS_GANACHE_HARD_WAIT_SECONDS: "30"
# Reduce how long a batch will stick around to avoid timeouts
GRAPH_STORE_WRITE_BATCH_DURATION: 30
# Basically, unlimted concurrency
N_CONCURRENT_TESTS: "1000"
with:
command: test
args: --verbose --package graph-tests parallel_integration_tests -- --nocapture

args: --test integration_tests -- --nocapture
- name: Cat graph-node.log
if: always()
run: cat tests/integration-tests/graph-node.log || echo "No graph-node.log"
rustfmt:
name: Check rustfmt style
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ lcov.info
/tests/**/generated
/tests/**/node_modules
/tests/**/yarn-error.log
/tests/**/pnpm-lock.yaml

# Built solidity contracts.
/tests/**/bin
Expand Down
91 changes: 4 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion chain/arweave/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ mod test {
kind: "".into(),
network: None,
name: "".into(),
source: Source { owner, start_block },
source: Source {
owner,
start_block,
end_block: None,
},
mapping: Mapping {
api_version: Version::new(1, 2, 3),
language: "".into(),
Expand Down
8 changes: 7 additions & 1 deletion chain/arweave/src/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ impl blockchain::DataSource<Chain> for DataSource {
kinds
}

fn end_block(&self) -> Option<BlockNumber> {
self.source.end_block
}

fn match_and_decode(
&self,
trigger: &<Chain as Blockchain>::TriggerData,
Expand Down Expand Up @@ -392,9 +396,11 @@ pub struct TransactionHandler {
}

#[derive(Clone, Debug, Hash, Eq, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Source {
// A data source that does not have an owner can only have block handlers.
pub(crate) owner: Option<String>,
#[serde(rename = "startBlock", default)]
#[serde(default)]
pub(crate) start_block: BlockNumber,
pub(crate) end_block: Option<BlockNumber>,
}
18 changes: 15 additions & 3 deletions chain/cosmos/src/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ impl blockchain::DataSource<Chain> for DataSource {
kinds
}

fn end_block(&self) -> Option<BlockNumber> {
self.source.end_block
}

fn match_and_decode(
&self,
trigger: &<Chain as Blockchain>::TriggerData,
Expand Down Expand Up @@ -502,9 +506,11 @@ pub struct MappingMessageHandler {
}

#[derive(Clone, Debug, Hash, Eq, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Source {
#[serde(rename = "startBlock", default)]
#[serde(default)]
pub start_block: BlockNumber,
pub(crate) end_block: Option<BlockNumber>,
}

#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Deserialize)]
Expand Down Expand Up @@ -657,7 +663,10 @@ mod tests {
kind: "cosmos".to_string(),
network: None,
name: "Test".to_string(),
source: Source { start_block: 1 },
source: Source {
start_block: 1,
end_block: None,
},
mapping: Mapping {
api_version: semver::Version::new(0, 0, 0),
language: "".to_string(),
Expand All @@ -679,7 +688,10 @@ mod tests {
kind: "cosmos".to_string(),
network: None,
name: "Test".to_string(),
source: Source { start_block: 1 },
source: Source {
start_block: 1,
end_block: None,
},
mapping: Mapping {
api_version: semver::Version::new(0, 0, 0),
language: "".to_string(),
Expand Down
Loading

0 comments on commit 753eb36

Please sign in to comment.