Skip to content

Merge pull request #168 from smartcontractkit/write-regression-tests #709

Merge pull request #168 from smartcontractkit/write-regression-tests

Merge pull request #168 from smartcontractkit/write-regression-tests #709

name: Integration Tests
# Runs all integration tests under tests/integration except TestTokenPool (token_pool_test.go
# and siloed_pool_migration_test.go). Those run in test-integration-token-pool.yaml.
on:
merge_group:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
test-integration:
name: Integration Tests (excl. Token Pool)
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Setup Rust toolchain
uses: ./.github/actions/setup-rust-toolchain
with:
wasm32-target: "true"
- name: Install Stellar CLI
uses: ./.github/actions/setup-stellar-cli
- name: Build contracts
run: make build
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
- name: Run integration tests
run: go test -v -race -tags integration -fullpath -shuffle on -skip '^TestTokenPool($|/)' -coverpkg=./bindings/contracts/... -coverprofile=coverage-integration.out ./tests/integration/...
- name: Write full coverage to job summary
if: github.event_name == 'pull_request'
run: |
echo '## Integration Test Coverage (excl. Token Pool)' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
go tool cover -func=coverage-integration.out >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Post coverage comment
if: github.event_name == 'pull_request'
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
TOTAL_LINE=$(go tool cover -func=coverage-integration.out | grep -i 'total' | tail -1 || echo 'No coverage summary found')
cat > coverage-summary.md <<EOF
## Integration Test Coverage (excl. Token Pool)
\`\`\`
${TOTAL_LINE}
\`\`\`
[Full coverage report](${RUN_URL})
EOF
sed -i 's/^ //' coverage-summary.md
- name: Post sticky comment
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4
with:
header: integration-coverage
path: coverage-summary.md