Skip to content

Commit

Permalink
Merge pull request #356 from smartcontractkit/fix_ci
Browse files Browse the repository at this point in the history
Fix ci
  • Loading branch information
archseer authored Mar 12, 2024
2 parents 021f7fd + a9ccf97 commit 89fdff2
Show file tree
Hide file tree
Showing 26 changed files with 1,132 additions and 883 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/integration-tests-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ concurrency:
cancel-in-progress: true

env:
CHAINLINK_ENV_USER: ${{ github.actor }}
TEST_LOG_LEVEL: debug
CL_ECR: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
ENV_JOB_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-starknet-tests:${{ github.sha }}
Expand Down Expand Up @@ -114,18 +113,12 @@ jobs:
image:
- name: ""
tag-suffix: ""
- name: (plugins)
test-name: embedded
- name: plugins
tag-suffix: -plugins
test-name: plugins
env:
TEST_SUITE: smoke
TEST_ARGS: -test.timeout 1h
PRIVATE_KEY: ${{ secrets.GOERLI_PRIVATE_KEY }}
ACCOUNT: ${{ secrets.GOERLI_ACCOUNT }}
TTL: 3h
TEST_DURATION: 15m
NODE_COUNT: 5
CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
CHAINLINK_VERSION: starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
permissions:
checks: write
pull-requests: write
Expand All @@ -147,10 +140,37 @@ jobs:
uses: cachix/install-nix-action@29bd9290ef037a3ecbdafe83cbd2185e9dd0fa0a # v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Install Cairo
uses: ./.github/actions/install-cairo
- name: Build contracts
run: |
cd contracts && scarb --profile release build
- name: Build gauntlet
run: |
yarn install && yarn build
- name: Generate config overrides
run: | # https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/config/README.md
cat << EOF > config.toml
[ChainlinkImage]
image="${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink"
version="starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}"
[Network]
selected_networks=["SIMULATED"]
[Common]
internal_docker_repo = "${{ env.INTERNAL_DOCKER_REPO }}"
stateful_db = false
EOF
# shellcheck disable=SC2002
BASE64_CONFIG_OVERRIDE=$(cat config.toml | base64 -w 0)
# shellcheck disable=SC2086
echo ::add-mask::$BASE64_CONFIG_OVERRIDE
# shellcheck disable=SC2086
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV
- name: Run Tests ${{ matrix.image.name }}
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ea889b3133bd7f16ab19ba4ba130de5d9162c669 # v2.3.4
with:
test_command_to_run: nix develop -c helm repo update && make test-integration-smoke-ci
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
test_command_to_run: nix develop -c helm repo update && make test=${{ matrix.image.test-name }} test-integration-smoke-ci
test_download_vendor_packages_command: cd integration-tests && nix develop -c go mod download
cl_repo: ${{ env.CL_ECR }}
cl_image_tag: starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
Expand All @@ -159,4 +179,4 @@ jobs:
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
artifacts_location: /home/runner/work/chainlink-starknet/chainlink-starknet/integration-tests/smoke/logs
artifacts_location: /home/runner/work/chainlink-starknet/chainlink-starknet/integration-tests/smoke/logs
132 changes: 0 additions & 132 deletions .github/workflows/integration-tests-soak.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,4 @@ ztarrepo.tar.gz
eslint-report.json
.run.id
.local-mock-server
override*.toml
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ test-integration-smoke: test-integration-prep
.PHONY: test-integration-smoke-ci
test-integration-smoke-ci:
cd integration-tests/ && \
go test --timeout=2h -v -count=1 -json ./smoke 2>&1 | tee /tmp/gotest.log | gotestfmt
go test --timeout=2h -v -count=1 -run TestOCRBasic/$(test) -json ./smoke

.PHONY: test-integration-soak
test-integration-soak: test-integration-prep
cd integration-tests/ && \
go test --timeout=1h -v -json./soak
go test --timeout=1h -v -json ./soak

# CI Already has already ran test-integration-prep
.PHONY: test-integration-soak-ci
Expand Down
Empty file added integration-tests/.root_dir
Empty file.
46 changes: 18 additions & 28 deletions integration-tests/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
# Local e2e testing
## Integration tests - HOWTO

Make sure to have `psql` installed locally. We use it to create a new database for each node.
### Prerequisites
1. `cd contracts && scarb --profile release build`
2. `yarn install`
3. `yarn build`

Create a new network for containers (only needs to be done once). A custom network allows containers to DNS resolve each other using container names.
#### TOML preparation
The integration tests are using TOML as the configuration input. The logic and parsing is located under [Test config](./testconfig)

```
docker network create chainlink
```
By default, the tests will be running with the default config set in [default.toml](./testconfig/default.toml). This configuration is set to run on devnet with local docker.

Build a custom core image with starknet relayer bumped to some commit.
Fields in the default toml can be overriden by creating an `overrides.toml`file. Any values specified here take precedence and will be overwritten if they overlap with `default.toml`.

```
cd ../core
go get github.com/smartcontractkit/chainlink-starknet/relayer@<MY COMMIT HERE>
docker build . -t smartcontract/chainlink:starknet -f ./core/chainlink.Dockerfile
```
##### Testnet runs
In order to run the tests on Testnet, additional variables need to be specified in the TOML, these would also be pointed out if `network = "testnet"` is set. The additional variables are:

Compile contracts and gauntlet:
- `l2_rpc_url` - L2 RPC url
- `account` - Account address on L2
- `private_key` - Private key for L2 account

```
yarn build
cd contracts
scarb --profile release build
```
##### Running in k8s

Run the tests!
Set `inside_k8 = true` under `[Common]`.

```
cd integration-tests
go test -count 1 -v -timeout 30m --run OCRBasic ./smoke
```
#### Run tests

Use `something.down.sh` scripts to teardown everything afterwards if the tests don't properly clean up.

# Old docs

For more information, see the [Chainlink Starknet Documentation | Integration Tests](../docs/integration-tests).
`cd integration-tests && go test --timeout=2h -v -count=1 -json ./smoke`
Loading

0 comments on commit 89fdff2

Please sign in to comment.