Skip to content

Commit

Permalink
tests: integrate cdk bats test ci to kurtosis-cdk (#387)
Browse files Browse the repository at this point in the history
* test: add e2e-test workflow for cdk

Signed-off-by: Ji Hwan <[email protected]>

* chore: cdk e2e ci test

Signed-off-by: Ji Hwan <[email protected]>

chore: update polycli version

Signed-off-by: Ji Hwan <[email protected]>

chore: fix ci

Signed-off-by: Ji Hwan <[email protected]>

chore: fix ci kurtosis_folder dir

Signed-off-by: Ji Hwan <[email protected]>

chore: fix bats_lib_path

Signed-off-by: Ji Hwan <[email protected]>

* chore: cleanup

Signed-off-by: Ji Hwan <[email protected]>

* chore: change test run to PR to main branch

Signed-off-by: Ji Hwan <[email protected]>

---------

Signed-off-by: Ji Hwan <[email protected]>
  • Loading branch information
jhkimqd authored Nov 20, 2024
1 parent 83d078c commit f760e2d
Showing 1 changed file with 101 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/cdk-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Test e2e
on:
pull_request:
push:
branches: [main]
workflow_dispatch: {}

jobs:
test-e2e:
strategy:
fail-fast: false
matrix:
go-version: [ 1.22.x ]
goarch: [ "amd64" ]
e2e-group:
- "fork9-validium"
- "fork11-rollup"
- "fork12-validium"
- "fork12-rollup"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
env:
GOARCH: ${{ matrix.goarch }}

- name: Install kurtosis
shell: bash
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli=1.4.1
kurtosis version
- name: Disable kurtosis analytics
shell: bash
run: kurtosis analytics disable

- name: Install yq
shell: bash
run: |
pip3 install yq
yq --version
- name: Install polycli
run: |
POLYCLI_VERSION="v0.1.63"
tmp_dir=$(mktemp -d)
curl -L "https://github.com/0xPolygon/polygon-cli/releases/download/${POLYCLI_VERSION}/polycli_${POLYCLI_VERSION}_linux_amd64.tar.gz" | tar -xz -C "$tmp_dir"
mv "$tmp_dir"/* /usr/local/bin/polycli
rm -rf "$tmp_dir"
sudo chmod +x /usr/local/bin/polycli
/usr/local/bin/polycli version
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

- name: checkout polygon-cdk
uses: actions/checkout@v4
with:
repository: 0xPolygon/cdk
path: "cdk"
ref: "v0.4.0-beta10"

- name: Build Docker
run: make build-docker
working-directory: ${{ github.workspace }}/cdk

- name: Setup Bats and bats libs
uses: bats-core/[email protected]

- name: Test
run: make test-e2e-${{ matrix.e2e-group }}
working-directory: ./cdk/test
env:
KURTOSIS_FOLDER: ${{ github.workspace }}
BATS_LIB_PATH: /usr/lib/

- name: Dump enclave logs
if: failure()
run: kurtosis dump ./dump

- name: Generate archive name
if: failure()
run: |
archive_name="dump_run_with_args_${{matrix.e2e-group}}_${{ github.run_id }}"
echo "ARCHIVE_NAME=${archive_name}" >> "$GITHUB_ENV"
echo "Generated archive name: ${archive_name}"
kurtosis service exec cdk cdk-node-001 'cat /etc/cdk/cdk-node-config.toml' > ./dump/cdk-node-config.toml
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}
path: ./dump

0 comments on commit f760e2d

Please sign in to comment.