Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tasiov committed Aug 22, 2023
1 parent fe5f254 commit b3c918f
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 115 deletions.
15 changes: 13 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
ignore:
- "test/.*"
coverage:
precision: 2
round: down
range: 90...100

status:
project:
default:
threshold: 6%
target: 90%
patch:
default:
enabled: no
65 changes: 9 additions & 56 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,63 +37,16 @@ jobs:
- name: Get mainnet GAS_LIMIT
run: echo "MAINNET_GAS_LIMIT=$(curl -s https://rpc.stargaze-apis.com/consensus_params | jq -r '.result.consensus_params.block.max_gas')" >> $GITHUB_ENV

- name: Mainnet block GAS_LIMIT changed
if: ${{ env.MAINNET_GAS_LIMIT != env.GAS_LIMIT }}
uses: actions/github-script@v6
with:
script: core.setFailed(`Integration tests must update GAS_LIMIT from ${process.env.GAS_LIMIT} to ${process.env.MAINNET_GAS_LIMIT}`)

- name: Deploy local Stargaze node
run: make deploy-local

- name: Download launchpad artifacts
run: make dl-launchpad-artifacts

- name: Download marketplace artifacts
run: make dl-marketplace-artifacts

- name: Optimize Contracts
run: make optimize

- name: Run Integration Tests
run: make e2e-test
- uses: extractions/setup-just@v1

- name: Combine Test Gas Reports
run: cd test/e2e/ && jq -rs 'reduce .[] as $item ({}; . * $item)' gas_reports/*.json > gas_report.json
- name: Download artifacts
run: just download-artifacts

- name: Raw Gas Report
run: cat test/e2e/gas_report.json
- name: Optimize contracts
run: just optimize

- name: Set GIT_BRANCH
run: echo "GIT_BRANCH=$(echo ${{ github.ref }} | sed 's|/|-|g')" >> $GITHUB_ENV
- name: Run local stargaze chain
run: just deploy-local

- name: Upload Gas Report
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3
with:
name: infinity-swap-gas-report-${{ env.GIT_BRANCH }}
path: test/e2e/gas_report.json
retention-days: 90

- name: Download main gas report
id: download_gas
# Because the max retention period of github artifacts is 90 days
# there's a possibility the main's report no longer exists
continue-on-error: true
if: ${{ github.ref != 'refs/heads/main' }}
# NOTE: We can't use github's `actions/download-artifact` because it doesnt support
# downloading an artifact cross workflows yet
# https://github.com/actions/download-artifact/issues/3
uses: dawidd6/action-download-artifact@v2
with:
branch: main
workflow: e2e.yml
name: infinity-swap-gas-report-refs-heads-main

- name: Post gas diff to PR
if: ${{ github.ref != 'refs/heads/main' && steps.download_gas.outputs.found_artifact == 'true' }}
uses: de-husk/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
current_json: test/e2e/gas_report.json
old_json: gas_report.json
- name: Run e2e tests
run: just e2e-test
115 changes: 58 additions & 57 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,71 @@ lint-fix:
schema:
sh scripts/schema.sh

# artifacts:
# mkdir -p artifacts
artifacts:
mkdir -p artifacts

# clear-artifacts: artifacts
# rm -rf artifacts
# mkdir -p artifacts
clear-artifacts: artifacts
rm -rf artifacts
mkdir -p artifacts

# download-artifacts: artifacts
# scripts/download-core-artifacts.sh
# scripts/download-launchpad-artifacts.sh
download-artifacts: artifacts
scripts/download-core-artifacts.sh
scripts/download-launchpad-artifacts.sh

# optimize:
# sh scripts/optimize.sh
optimize:
sh scripts/optimize.sh

# optimize-arm:
# sh scripts/optimize-arm.sh
optimize-arm:
sh scripts/optimize-arm.sh

# deploy-local:
# #!/usr/bin/env bash
# TEST_ADDRS=`jq -r '.[].address' ./typescript/packages/e2e-tests/configs/test_accounts.json | tr '\n' ' '`
# docker kill stargaze || true
# docker volume rm -f stargaze_data
# docker run --rm -d --name stargaze \
# -e DENOM=ustars \
# -e CHAINID=testing \
# -e GAS_LIMIT=75000000 \
# -p 1317:1317 \
# -p 26656:26656 \
# -p 26657:26657 \
# -p 9090:9090 \
# --mount type=volume,source=stargaze_data,target=/root \
# publicawesome/stargaze:10.0.1 /data/entry-point.sh $TEST_ADDRS
deploy-local:
#!/usr/bin/env bash
TEST_ADDRS=`jq -r '.[].address' ./typescript/packages/e2e-tests/configs/test_accounts.json | tr '\n' ' '`
docker kill stargaze || true
docker volume rm -f stargaze_data
docker run --rm -d --name stargaze \
-e DENOM=ustars \
-e CHAINID=testing \
-e GAS_LIMIT=75000000 \
-p 1317:1317 \
-p 26656:26656 \
-p 26657:26657 \
-p 9090:9090 \
--mount type=volume,source=stargaze_data,target=/root \
publicawesome/stargaze:11.0.0 /data/entry-point.sh $TEST_ADDRS
# deploy-local-arm:
# #!/usr/bin/env bash
# TEST_ADDRS=`jq -r '.[].address' ./typescript/packages/e2e-tests/configs/test_accounts.json | tr '\n' ' '`
# docker kill stargaze || true
# docker volume rm -f stargaze_data
# docker run --rm -d --name stargaze \
# -e DENOM=ustars \
# -e CHAINID=testing \
# -e GAS_LIMIT=75000000 \
# -p 1317:1317 \
# -p 26656:26656 \
# -p 26657:26657 \
# -p 9090:9090 \
# --mount type=volume,source=stargaze_data,target=/root \
# --platform linux/amd64 \
# publicawesome/stargaze:10.0.1 /data/entry-point.sh $TEST_ADDRS
deploy-local-arm:
#!/usr/bin/env bash
TEST_ADDRS=`jq -r '.[].address' ./typescript/packages/e2e-tests/configs/test_accounts.json | tr '\n' ' '`
docker kill stargaze || true
docker volume rm -f stargaze_data
docker run --rm -d --name stargaze \
-e DENOM=ustars \
-e CHAINID=testing \
-e GAS_LIMIT=75000000 \
-p 1317:1317 \
-p 26656:26656 \
-p 26657:26657 \
-p 9090:9090 \
--mount type=volume,source=stargaze_data,target=/root \
--platform linux/amd64 \
publicawesome/stargaze:11.0.0 /data/entry-point.sh $TEST_ADDRS
# e2e-test:
# #!/usr/bin/env bash
# START_DIR=$(pwd)
# cd typescript/packages/e2e-tests
# yarn install
# yarn test
e2e-test:
#!/usr/bin/env bash
START_DIR=$(pwd)
cd typescript/packages/e2e-tests
yarn install
yarn test
# e2e-test-full: download-artifacts optimize deploy-local e2e-test
e2e-test-full: download-artifacts optimize deploy-local e2e-test

# e2e-test-full-arm: download-artifacts optimize-arm deploy-local-arm e2e-test
e2e-test-full-arm: download-artifacts optimize-arm deploy-local-arm e2e-test

# e2e-watch: deploy-local-arm
# #!/usr/bin/env bash
# START_DIR=$(pwd)
# cd typescript/packages/e2e-tests
# yarn test
# yarn test:watch
e2e-watch: deploy-local-arm
#!/usr/bin/env bash
START_DIR=$(pwd)
cd typescript/packages/e2e-tests
yarn test
yarn test:watch

0 comments on commit b3c918f

Please sign in to comment.