Skip to content

Commit

Permalink
Base 1 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
raghu0891 committed Nov 21, 2024
1 parent 9b03560 commit 1bfb6ed
Show file tree
Hide file tree
Showing 335 changed files with 15,211 additions and 9,859 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}
2 changes: 2 additions & 0 deletions .github/actions/build-test-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ inputs:
runs:
using: composite
steps:
- name: Install Cairo
uses: ./.github/actions/install-cairo
- name: Check if image exists
id: check-image
uses: goplugin/plugin-github-actions/docker/image-exists@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
Expand Down
33 changes: 33 additions & 0 deletions .github/actions/install-cairo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Install Cairo and Scarb
description: A composite action that installs cairo and scarb binaries

inputs:
cairo_version:
description: Cairo release version
default: "v2.2.0"
required: false
scarb_version:
description: Scarb release version
default: "v0.7.0"
required: false

runs:
using: composite
steps:
- name: Setup Cairo for Linux
id: install-cairo
shell: bash
run: |
wget https://github.com/starkware-libs/cairo/releases/download/${{ inputs.cairo_version }}/release-x86_64-unknown-linux-musl.tar.gz
tar -xvzf release-x86_64-unknown-linux-musl.tar.gz
mv -vf cairo cairo-build
echo "$GITHUB_WORKSPACE/cairo-build/bin" >> $GITHUB_PATH
- name: Setup Scarb for Linux
id: install-scarb
shell: bash
run: |
wget https://github.com/software-mansion/scarb/releases/download/${{ inputs.scarb_version }}/scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz
tar -xvzf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz
mv -vf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl scarb-build
echo "$GITHUB_WORKSPACE/scarb-build/bin" >> $GITHUB_PATH
2 changes: 2 additions & 0 deletions .github/workflows/amarna.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
analyze:
runs-on: ubuntu-latest
# TODO: re-enable when amarna supports cairo 1.0
if: false
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Run Amarna
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
pull_request:

jobs:
contracts_run_tests:
name: Run Tests
contracts_run_ts_tests:
name: Run Typescript Tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -20,5 +20,29 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Install Cairo
uses: ./.github/actions/install-cairo

- name: Install starknet-devnet (via venv+pip)
run: nix develop -c pip install -r contracts/requirements.txt -c contracts/constraints.txt

- name: Test
run: nix develop -c make test-ts-contracts

contracts_run_cairo_tests:
name: Run Cairo Tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

- name: Install Nix
uses: cachix/install-nix-action@5c11eae19dba042788936d4f1c9685fdd814ac49 # v19
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Install Cairo
uses: ./.github/actions/install-cairo

- name: Test
run: nix develop -c make test-cairo-contracts
27 changes: 27 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
- name: Lint relayer
run: nix develop -c make lint-go-relayer
- name: Print Report
if: failure()
run: cat ./relayer/golangci-lint-relayer-report.xml
- name: Store Golangci lint relayer report artifact
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: golangci-lint-relayer-report
path: ./relayer/golangci-lint-relayer-report.xml

golang_lint_ops:
name: Golang Lint Ops
Expand All @@ -52,6 +61,15 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
- name: Lint ops
run: nix develop -c make lint-go-ops
- name: Print Report
if: failure()
run: cat ./ops/golangci-lint-ops-report.xml
- name: Store Golangci lint ops report artifact
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: golangci-lint-ops-report
path: ./ops/golangci-lint-ops-report.xml

golang_lint_integration_tests:
name: Golang Lint Integration Tests
Expand All @@ -66,6 +84,15 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
- name: Lint integration-tests
run: nix develop -c make lint-go-test
- name: Print Report
if: failure()
run: cat ./integration-tests/golangci-lint-integration-tests-report.xml
- name: Store Golangci lint integration tests report artifact
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: golangci-lint-integration-tests-report
path: ./integration-tests/golangci-lint-integration-tests-report.xml
# 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:
# 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] ...
# 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\""
Expand Down
46 changes: 33 additions & 13 deletions .github/workflows/integration-tests-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,51 @@ jobs:
permissions:
id-token: write
contents: read
strategy:
matrix:
image:
- name: ""
dockerfile: core/plugin.Dockerfile
tag-suffix: ""
- name: (plugins)
dockerfile: plugins/plugin.Dockerfile
tag-suffix: -plugins
steps:
- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: goplugin/push-gha-metrics-action@808c183d1f5c26a4f3fd50b75d3cf7b58d9aa293
uses: goplugin/push-gha-metrics-action@90fcbaac8ebf86da9c4d55dba24f6fe3029f0e0b
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: Build Custom CL Image
continue-on-error: true
- name: Check if image exists
id: check-image
uses: goplugin/plugin-github-actions/docker/image-exists@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
uses: goplugin/plugin-github-actions/docker/image-exists@2c9f401149f6c25fb632067b7e6626aebeee5d69 # v2.1.6
with:
repository: plugin
tag: starknet.${{ github.sha }}
tag: starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- name: Build Image
- name: Build Image ${{ matrix.image.name }}
if: steps.check-image.outputs.exists == 'false'
# note using a temporary commit for build-image that works around the go get issues, replace when go get issues are fixed please
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@a2bf54158aa0a77a55f432347bc9ecf8ef642c2b # cosmos_one_off
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@2c9f401149f6c25fb632067b7e6626aebeee5d69
with:
cl_repo: goplugin/pluginv3.0
cl_ref: ${{ github.event.inputs.cl_branch_ref }}
cl_dockerfile: ${{ matrix.image.dockerfile }}
# commit of the caller branch
dep_starknet_sha: ${{ github.event.pull_request.head.sha || github.sha }}
push_tag: ${{ env.CL_ECR }}:starknet.${{ github.sha }}
push_tag: ${{ env.CL_ECR }}:starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_PRIVATE_GHA_PULL: ${{ secrets.QA_PRIVATE_GHA_PULL }}
- name: Print Plugin Image Built
run: |
echo "### plugin image tag used for this test run :link:" >> $GITHUB_STEP_SUMMARY
echo "\`starknet.${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "\`starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}\`" >> $GITHUB_STEP_SUMMARY
build_test_image:
environment: integration
Expand Down Expand Up @@ -97,13 +107,23 @@ jobs:
runs-on: ubuntu20.04-16cores-64GB
needs: [ build_custom_plugin_image, build_test_image ]
environment: integration
# these values need to match those used to build the plugin image
strategy:
matrix:
image:
- name: ""
tag-suffix: ""
- name: (plugins)
tag-suffix: -plugins
env:
TEST_SUITE: smoke
TEST_ARGS: -test.timeout 1h
PRIVATE_KEY: ${{ secrets.GOERLI_PRIVATE_KEY }}
ACCOUNT: ${{ secrets.GOERLI_ACCOUNT }}
TTL: 1h
TTL: 3h
TEST_DURATION: 15m
NODE_COUNT: 5
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
permissions:
checks: write
pull-requests: write
Expand All @@ -113,25 +133,25 @@ jobs:
- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: goplugin/push-gha-metrics-action@808c183d1f5c26a4f3fd50b75d3cf7b58d9aa293
uses: goplugin/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: Run Smoke Tests
this-job-name: Run Smoke Tests ${{ matrix.image.name }}
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Install Nix
uses: cachix/install-nix-action@29bd9290ef037a3ecbdafe83cbd2185e9dd0fa0a # v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run Tests
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
- name: Run Tests ${{ matrix.image.name }}
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@2c9f401149f6c25fb632067b7e6626aebeee5d69
with:
test_command_to_run: nix develop -c make 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 }}
cl_image_tag: starknet.${{ github.sha }}${{ matrix.image.tag-suffix }}
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/integration-tests-soak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,18 @@ on:
required: true
default: 72h
type: string


test_duration:
description: Duration of soak
required: true
default: 72h
type: string
private_key:
description: Private key, ignore for devnet
required: false
type: string
account:
description: Account address, ignore for devnet
required: false

# Only run 1 of this workflow at a time per PR
concurrency:
Expand All @@ -48,16 +58,15 @@ jobs:
steps:
- name: Check if image exists
id: check-image
uses: goplugin/plugin-github-actions/docker/image-exists@8489879838862929f43f7d7cd1b33903965cf507 # v2.1.6
uses: goplugin/plugin-github-actions/docker/image-exists@2c9f401149f6c25fb632067b7e6626aebeee5d69 # v2.1.6
with:
repository: plugin
tag: starknet.${{ github.sha }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- name: Build Image
if: steps.check-image.outputs.exists == 'false'
# note using a temporary commit for build-image that works around the go get issues, replace when go get issues are fixed please
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@a2bf54158aa0a77a55f432347bc9ecf8ef642c2b # cosmos_one_off
uses: goplugin/plugin-github-actions/plugin-testing-framework/build-image@2c9f401149f6c25fb632067b7e6626aebeee5d69
with:
cl_repo: goplugin/pluginv3.0
# By default we are integrating with CL develop
Expand All @@ -81,14 +90,16 @@ jobs:
env:
PLUGIN_ENV_USER: ${{ github.actor }}
L2_RPC_URL: ${{ github.event.inputs.l2_rpc_url }}
TEST_DURATION: ${{ github.event.inputs.test_duration }}
NODE_COUNT: ${{ github.event.inputs.node_count }}
PRIVATE_KEY: ${{ secrets.GOERLI_PRIVATE_KEY }}
ACCOUNT: ${{ secrets.GOERLI_ACCOUNT }}
PRIVATE_KEY: ${{ github.event.inputs.private_key }}
ACCOUNT: ${{ github.event.inputs.account }}
TTL: ${{ github.event.inputs.ttl }}
DETACH_RUNNER: true
TEST_SUITE: soak
TEST_ARGS: -test.timeout ${{ github.event.inputs.ttl }}
TEST_LOG_LEVEL: debug
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
permissions:
checks: write
pull-requests: write
Expand All @@ -108,7 +119,7 @@ jobs:
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
- name: Run Tests
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
uses: goplugin/plugin-github-actions/plugin-testing-framework/run-tests@2c9f401149f6c25fb632067b7e6626aebeee5d69 # v2.1.2
with:
test_command_to_run: nix develop -c make test-integration-soak-ci
test_download_vendor_packages_command: cd integration-tests && nix develop -c go mod download
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/integration_contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Install Nix
uses: cachix/install-nix-action@29bd9290ef037a3ecbdafe83cbd2185e9dd0fa0a # v20
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Install Cairo
uses: ./.github/actions/install-cairo

- name: Install starknet-devnet (via venv+pip)
run: nix develop -c pip install -r contracts/requirements.txt -c contracts/constraints.txt

- name: Test
run: nix develop -c make test-integration-contracts
Loading

0 comments on commit 1bfb6ed

Please sign in to comment.