Skip to content

Commit 1bfb6ed

Browse files
committed
Base 1 commit
1 parent 9b03560 commit 1bfb6ed

File tree

335 files changed

+15211
-9859
lines changed

Some content is hidden

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

335 files changed

+15211
-9859
lines changed

.eslintrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module"
14+
},
15+
"plugins": [
16+
"@typescript-eslint"
17+
],
18+
"rules": {
19+
}
20+
}

.github/actions/build-test-image/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ inputs:
2222
runs:
2323
using: composite
2424
steps:
25+
- name: Install Cairo
26+
uses: ./.github/actions/install-cairo
2527
- name: Check if image exists
2628
id: check-image
2729
uses: goplugin/plugin-github-actions/docker/image-exists@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Install Cairo and Scarb
2+
description: A composite action that installs cairo and scarb binaries
3+
4+
inputs:
5+
cairo_version:
6+
description: Cairo release version
7+
default: "v2.2.0"
8+
required: false
9+
scarb_version:
10+
description: Scarb release version
11+
default: "v0.7.0"
12+
required: false
13+
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Setup Cairo for Linux
18+
id: install-cairo
19+
shell: bash
20+
run: |
21+
wget https://github.com/starkware-libs/cairo/releases/download/${{ inputs.cairo_version }}/release-x86_64-unknown-linux-musl.tar.gz
22+
tar -xvzf release-x86_64-unknown-linux-musl.tar.gz
23+
mv -vf cairo cairo-build
24+
echo "$GITHUB_WORKSPACE/cairo-build/bin" >> $GITHUB_PATH
25+
26+
- name: Setup Scarb for Linux
27+
id: install-scarb
28+
shell: bash
29+
run: |
30+
wget https://github.com/software-mansion/scarb/releases/download/${{ inputs.scarb_version }}/scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz
31+
tar -xvzf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz
32+
mv -vf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl scarb-build
33+
echo "$GITHUB_WORKSPACE/scarb-build/bin" >> $GITHUB_PATH

.github/workflows/amarna.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
analyze:
1111
runs-on: ubuntu-latest
12+
# TODO: re-enable when amarna supports cairo 1.0
13+
if: false
1214
steps:
1315
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
1416
- name: Run Amarna

.github/workflows/contracts.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
pull_request:
99

1010
jobs:
11-
contracts_run_tests:
12-
name: Run Tests
11+
contracts_run_ts_tests:
12+
name: Run Typescript Tests
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout sources
@@ -20,5 +20,29 @@ jobs:
2020
with:
2121
nix_path: nixpkgs=channel:nixos-unstable
2222

23+
- name: Install Cairo
24+
uses: ./.github/actions/install-cairo
25+
26+
- name: Install starknet-devnet (via venv+pip)
27+
run: nix develop -c pip install -r contracts/requirements.txt -c contracts/constraints.txt
28+
2329
- name: Test
2430
run: nix develop -c make test-ts-contracts
31+
32+
contracts_run_cairo_tests:
33+
name: Run Cairo Tests
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout sources
37+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
38+
39+
- name: Install Nix
40+
uses: cachix/install-nix-action@5c11eae19dba042788936d4f1c9685fdd814ac49 # v19
41+
with:
42+
nix_path: nixpkgs=channel:nixos-unstable
43+
44+
- name: Install Cairo
45+
uses: ./.github/actions/install-cairo
46+
47+
- name: Test
48+
run: nix develop -c make test-cairo-contracts

.github/workflows/golangci-lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ jobs:
3838
nix_path: nixpkgs=channel:nixos-unstable
3939
- name: Lint relayer
4040
run: nix develop -c make lint-go-relayer
41+
- name: Print Report
42+
if: failure()
43+
run: cat ./relayer/golangci-lint-relayer-report.xml
44+
- name: Store Golangci lint relayer report artifact
45+
if: always()
46+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
47+
with:
48+
name: golangci-lint-relayer-report
49+
path: ./relayer/golangci-lint-relayer-report.xml
4150

4251
golang_lint_ops:
4352
name: Golang Lint Ops
@@ -52,6 +61,15 @@ jobs:
5261
nix_path: nixpkgs=channel:nixos-unstable
5362
- name: Lint ops
5463
run: nix develop -c make lint-go-ops
64+
- name: Print Report
65+
if: failure()
66+
run: cat ./ops/golangci-lint-ops-report.xml
67+
- name: Store Golangci lint ops report artifact
68+
if: always()
69+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
70+
with:
71+
name: golangci-lint-ops-report
72+
path: ./ops/golangci-lint-ops-report.xml
5573

5674
golang_lint_integration_tests:
5775
name: Golang Lint Integration Tests
@@ -66,6 +84,15 @@ jobs:
6684
nix_path: nixpkgs=channel:nixos-unstable
6785
- name: Lint integration-tests
6886
run: nix develop -c make lint-go-test
87+
- name: Print Report
88+
if: failure()
89+
run: cat ./integration-tests/golangci-lint-integration-tests-report.xml
90+
- name: Store Golangci lint integration tests report artifact
91+
if: always()
92+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
93+
with:
94+
name: golangci-lint-integration-tests-report
95+
path: ./integration-tests/golangci-lint-integration-tests-report.xml
6996
# Note: I could not figure out why the golangci-lint-action would not work even though it is technically running the same as above, error message is this:
7097
# Running [/home/runner/golangci-lint-1.50.1-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=integration-tests --exclude=dot-imports] in [/home/runner/work/plugin-starknet/plugin-starknet/integration-tests] ...
7198
# level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package client: could not load export data: no export data for \"github.com/goplugin/plugin-testing-framework/client\""

.github/workflows/integration-tests-smoke.yml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,51 @@ jobs:
2929
permissions:
3030
id-token: write
3131
contents: read
32+
strategy:
33+
matrix:
34+
image:
35+
- name: ""
36+
dockerfile: core/plugin.Dockerfile
37+
tag-suffix: ""
38+
- name: (plugins)
39+
dockerfile: plugins/plugin.Dockerfile
40+
tag-suffix: -plugins
3241
steps:
3342
- name: Collect Metrics
3443
if: always()
3544
id: collect-gha-metrics
36-
uses: goplugin/push-gha-metrics-action@808c183d1f5c26a4f3fd50b75d3cf7b58d9aa293
45+
uses: goplugin/push-gha-metrics-action@90fcbaac8ebf86da9c4d55dba24f6fe3029f0e0b
3746
with:
3847
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
3948
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
4049
this-job-name: Build Custom CL Image
4150
continue-on-error: true
4251
- name: Check if image exists
4352
id: check-image
44-
uses: goplugin/plugin-github-actions/docker/image-exists@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
53+
uses: goplugin/plugin-github-actions/docker/image-exists@2c9f401149f6c25fb632067b7e6626aebeee5d69 # v2.1.6
4554
with:
4655
repository: plugin
47-
tag: starknet.${{ github.sha }}
56+
tag: starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
4857
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
4958
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
50-
- name: Build Image
59+
- name: Build Image ${{ matrix.image.name }}
5160
if: steps.check-image.outputs.exists == 'false'
5261
# note using a temporary commit for build-image that works around the go get issues, replace when go get issues are fixed please
53-
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@a2bf54158aa0a77a55f432347bc9ecf8ef642c2b # cosmos_one_off
62+
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@2c9f401149f6c25fb632067b7e6626aebeee5d69
5463
with:
5564
cl_repo: goplugin/pluginv3.0
5665
cl_ref: ${{ github.event.inputs.cl_branch_ref }}
66+
cl_dockerfile: ${{ matrix.image.dockerfile }}
5767
# commit of the caller branch
5868
dep_starknet_sha: ${{ github.event.pull_request.head.sha || github.sha }}
59-
push_tag: ${{ env.CL_ECR }}:starknet.${{ github.sha }}
69+
push_tag: ${{ env.CL_ECR }}:starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
6070
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
6171
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
6272
QA_PRIVATE_GHA_PULL: ${{ secrets.QA_PRIVATE_GHA_PULL }}
6373
- name: Print Plugin Image Built
6474
run: |
6575
echo "### plugin image tag used for this test run :link:" >> $GITHUB_STEP_SUMMARY
66-
echo "\`starknet.${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
76+
echo "\`starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}\`" >> $GITHUB_STEP_SUMMARY
6777
6878
build_test_image:
6979
environment: integration
@@ -97,13 +107,23 @@ jobs:
97107
runs-on: ubuntu20.04-16cores-64GB
98108
needs: [ build_custom_plugin_image, build_test_image ]
99109
environment: integration
110+
# these values need to match those used to build the plugin image
111+
strategy:
112+
matrix:
113+
image:
114+
- name: ""
115+
tag-suffix: ""
116+
- name: (plugins)
117+
tag-suffix: -plugins
100118
env:
101119
TEST_SUITE: smoke
102120
TEST_ARGS: -test.timeout 1h
103121
PRIVATE_KEY: ${{ secrets.GOERLI_PRIVATE_KEY }}
104122
ACCOUNT: ${{ secrets.GOERLI_ACCOUNT }}
105-
TTL: 1h
123+
TTL: 3h
124+
TEST_DURATION: 15m
106125
NODE_COUNT: 5
126+
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
107127
permissions:
108128
checks: write
109129
pull-requests: write
@@ -113,25 +133,25 @@ jobs:
113133
- name: Collect Metrics
114134
if: always()
115135
id: collect-gha-metrics
116-
uses: goplugin/push-gha-metrics-action@808c183d1f5c26a4f3fd50b75d3cf7b58d9aa293
136+
uses: goplugin/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0
117137
with:
118138
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
119139
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
120-
this-job-name: Run Smoke Tests
140+
this-job-name: Run Smoke Tests ${{ matrix.image.name }}
121141
continue-on-error: true
122142
- name: Checkout the repo
123143
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
124144
- name: Install Nix
125145
uses: cachix/install-nix-action@29bd9290ef037a3ecbdafe83cbd2185e9dd0fa0a # v20
126146
with:
127147
nix_path: nixpkgs=channel:nixos-unstable
128-
- name: Run Tests
129-
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
148+
- name: Run Tests ${{ matrix.image.name }}
149+
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@2c9f401149f6c25fb632067b7e6626aebeee5d69
130150
with:
131151
test_command_to_run: nix develop -c make test-integration-smoke-ci
132152
test_download_vendor_packages_command: cd integration-tests && nix develop -c go mod download
133153
cl_repo: ${{ env.CL_ECR }}
134-
cl_image_tag: starknet.${{ github.sha }}
154+
cl_image_tag: starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
135155
token: ${{ secrets.GITHUB_TOKEN }}
136156
go_mod_path: ./integration-tests/go.mod
137157
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}

.github/workflows/integration-tests-soak.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,18 @@ on:
2626
required: true
2727
default: 72h
2828
type: string
29-
30-
29+
test_duration:
30+
description: Duration of soak
31+
required: true
32+
default: 72h
33+
type: string
34+
private_key:
35+
description: Private key, ignore for devnet
36+
required: false
37+
type: string
38+
account:
39+
description: Account address, ignore for devnet
40+
required: false
3141

3242
# Only run 1 of this workflow at a time per PR
3343
concurrency:
@@ -48,16 +58,15 @@ jobs:
4858
steps:
4959
- name: Check if image exists
5060
id: check-image
51-
uses: goplugin/plugin-github-actions/docker/image-exists@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
61+
uses: goplugin/plugin-github-actions/docker/image-exists@2c9f401149f6c25fb632067b7e6626aebeee5d69 # v2.1.6
5262
with:
5363
repository: plugin
5464
tag: starknet.${{ github.sha }}
5565
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
5666
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
5767
- name: Build Image
5868
if: steps.check-image.outputs.exists == 'false'
59-
# note using a temporary commit for build-image that works around the go get issues, replace when go get issues are fixed please
60-
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@a2bf54158aa0a77a55f432347bc9ecf8ef642c2b # cosmos_one_off
69+
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@2c9f401149f6c25fb632067b7e6626aebeee5d69
6170
with:
6271
cl_repo: goplugin/pluginv3.0
6372
# By default we are integrating with CL develop
@@ -81,14 +90,16 @@ jobs:
8190
env:
8291
PLUGIN_ENV_USER: ${{ github.actor }}
8392
L2_RPC_URL: ${{ github.event.inputs.l2_rpc_url }}
93+
TEST_DURATION: ${{ github.event.inputs.test_duration }}
8494
NODE_COUNT: ${{ github.event.inputs.node_count }}
85-
PRIVATE_KEY: ${{ secrets.GOERLI_PRIVATE_KEY }}
86-
ACCOUNT: ${{ secrets.GOERLI_ACCOUNT }}
95+
PRIVATE_KEY: ${{ github.event.inputs.private_key }}
96+
ACCOUNT: ${{ github.event.inputs.account }}
8797
TTL: ${{ github.event.inputs.ttl }}
8898
DETACH_RUNNER: true
8999
TEST_SUITE: soak
90100
TEST_ARGS: -test.timeout ${{ github.event.inputs.ttl }}
91101
TEST_LOG_LEVEL: debug
102+
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
92103
permissions:
93104
checks: write
94105
pull-requests: write
@@ -108,7 +119,7 @@ jobs:
108119
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
109120
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
110121
- name: Run Tests
111-
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
122+
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@2c9f401149f6c25fb632067b7e6626aebeee5d69 # v2.1.2
112123
with:
113124
test_command_to_run: nix develop -c make test-integration-soak-ci
114125
test_download_vendor_packages_command: cd integration-tests && nix develop -c go mod download

.github/workflows/integration_contracts.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ jobs:
1414
steps:
1515
- name: Checkout sources
1616
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
17+
1718
- name: Install Nix
1819
uses: cachix/install-nix-action@29bd9290ef037a3ecbdafe83cbd2185e9dd0fa0a # v20
1920
with:
2021
nix_path: nixpkgs=channel:nixos-unstable
2122

23+
- name: Install Cairo
24+
uses: ./.github/actions/install-cairo
25+
26+
- name: Install starknet-devnet (via venv+pip)
27+
run: nix develop -c pip install -r contracts/requirements.txt -c contracts/constraints.txt
28+
2229
- name: Test
2330
run: nix develop -c make test-integration-contracts

0 commit comments

Comments
 (0)