Skip to content

Commit

Permalink
Merge pull request #168 from ava-labs/remove-bash-integration-tests
Browse files Browse the repository at this point in the history
Remove bash integration tests
  • Loading branch information
cam-schultz authored Dec 5, 2023
2 parents 8263940 + 1b9dead commit bf805e5
Show file tree
Hide file tree
Showing 21 changed files with 110 additions and 1,464 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/e2e.yml

This file was deleted.

43 changes: 42 additions & 1 deletion .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Snyk Golang
name: Snyk
on:
push:
branches-ignore:
Expand Down Expand Up @@ -27,3 +27,44 @@ jobs:
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: snyk.sarif
docker-snyk:
runs-on: ubuntu-20.04
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout repositories and submodules
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build local-network-image
run: |
source ./scripts/utils.sh
source ./scripts/versions.sh
setARCH
docker compose -f docker/docker-compose-run.yml --project-directory ./ build local_network
- name: Run Snyk on Docker image
# Dependabot isn't allowed to use the Snyk token, so skip this step.
if: ${{ ! startsWith(env.BRANCH_NAME, 'dependabot') }}
# TODO: Once we address the sarif upload issue below, we can re-enable
# continue-on-error to then upload the results to github.
# Snyk can be used to break the build when it detects vulnerabilities.
# In this case we want to upload the issues to GitHub Code Scanning
# continue-on-error: true
uses: snyk/actions/docker@master
env:
# In order to use the Snyk Action you will need to have a Snyk API token.
# More details in https://github.com/snyk/actions#getting-your-snyk-token
# or you can signup for free at https://snyk.io/login
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: local-network-image
args: --file=docker/Dockerfile --severity-threshold=high

# TODO: Investigate how to limit the snyk.sarif file to only have a maximum of 20 "runs" so the upload succeeds here.
# See: https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#validating-your-sarif-file
# - name: Upload results to GitHub Code Scanning
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: snyk.sarif
72 changes: 28 additions & 44 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: E2E and Solidity Unit Tests

on:
push:
Expand All @@ -9,65 +9,49 @@ on:
- "*"

jobs:
teleporter-integration-test:
solidity-unit-tests:
runs-on: ubuntu-20.04
timeout-minutes: 30
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
timeout-minutes: 10
steps:
- name: Checkout repositories and submodules
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive

- name: Download awm-relayer image
run: |
source ./scripts/versions.sh
docker pull avaplatform/awm-relayer:${AWM_RELAYER_VERSION}
- name: Install Foundry
run: ./scripts/install_foundry.sh

- name: Teleporter Integration Tests
- name: Run unit tests
run: |
./scripts/local/test.sh
- name: Run Snyk on Docker image
# Dependabot isn't allowed to use the Snyk token, so skip this step.
if: ${{ ! startsWith(env.BRANCH_NAME, 'dependabot') }}
# TODO: Once we address the sarif upload issue below, we can re-enable
# continue-on-error to then upload the results to github.
# Snyk can be used to break the build when it detects vulnerabilities.
# In this case we want to upload the issues to GitHub Code Scanning
# continue-on-error: true
uses: snyk/actions/docker@master
env:
# In order to use the Snyk Action you will need to have a Snyk API token.
# More details in https://github.com/snyk/actions#getting-your-snyk-token
# or you can signup for free at https://snyk.io/login
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: local-network-image
args: --file=docker/Dockerfile --severity-threshold=high

# TODO: Investigate how to limit the snyk.sarif file to only have a maximum of 20 "runs" so the upload succeeds here.
# See: https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#validating-your-sarif-file
# - name: Upload results to GitHub Code Scanning
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: snyk.sarif

solidity-unit-tests:
export PATH=$PATH:$HOME/.foundry/bin
cd contracts/
forge test -vvv
e2e_tests:
name: e2e_tests
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Checkout repository and submodules
- name: Checkout repositories and submodules
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set Go version
run: |
source ./scripts/versions.sh
GO_VERSION=$GO_VERSION >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Foundry
run: ./scripts/install_foundry.sh

- name: Run unit tests
- name: Run E2E Tests
# Forge installs to BASE_DIR, but updates the PATH definition in $HOME/.bashrc
run: |
export PATH=$PATH:$HOME/.foundry/bin
cd contracts/
forge test -vvv
export PATH="$PATH:$GOPATH/bin"
./scripts/local/e2e_test.sh
11 changes: 4 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,16 @@ To start developing on Teleporter, you'll need Solidity >= v0.8.18. [Foundry](ht

#### Local

- Run the integration tests in Docker
- Run the end-to-end tests

```sh
./scripts/local/test.sh
./scripts/local/e2e_test.sh
```

- Run the linter
- Run the Solidity and Golang linters

```sh
npm install solhint
npx solhint --version
cd contracts
npx solhint **/*.sol --config ./.solhint.json --ignore-path ./.solhintignore --max-warnings 0
./scripts/lint.sh
```

### Continuous Integration (CI)
Expand Down
Loading

0 comments on commit bf805e5

Please sign in to comment.