Use testcontainers in upgrade tests #1684
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- main | |
- rel/** | |
pull_request: | |
paths: | |
- ".github/workflows/test.yml" | |
- "pkg/**" | |
- "cmd/**" | |
- "dev/**" | |
- "go.mod" | |
- "go.sum" | |
- "tools.go" | |
jobs: | |
test: | |
name: Test (Node) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-tags: true | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: "**/*.sum" | |
- run: dev/docker/up | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: v1.0.0 | |
- run: contracts/dev/deploy local | |
- run: dev/register-local-node | |
- name: Run Tests | |
run: | | |
export GOPATH="${HOME}/go/" | |
export PATH="${PATH}:${GOPATH}/bin" | |
go install github.com/jstemmer/go-junit-report/v2@latest | |
go test -v ./... | go-junit-report -set-exit-code -iocopy -out report.xml | |
- name: Run Race Tests | |
run: | | |
export GOPATH="${HOME}/go/" | |
export PATH="${PATH}:${GOPATH}/bin" | |
go test -v ./... -race | |
- name: Run Upgrade Tests | |
id: upgrade_tests | |
continue-on-error: true | |
run: | | |
export GOPATH="${HOME}/go/" | |
export PATH="${PATH}:${GOPATH}/bin" | |
export ENABLE_UPGRADE_TESTS=1 | |
go test github.com/xmtp/xmtpd/pkg/upgrade -v | |
- name: Upgrade tests results | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const outcome = '${{ steps.upgrade_tests.outcome }}'; | |
const emoji = outcome === 'success' ? '✅' : '❌'; | |
const status = outcome === 'success' ? 'passed' : 'failed'; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `${emoji} Upgrade tests ${status}. ${outcome !== 'success' ? 'Please check the logs for more details.' : ''}` | |
}) | |
- uses: datadog/junit-upload-github-action@v1 | |
with: | |
api-key: ${{ secrets.DD_API_KEY }} | |
service: xmtp-node-go | |
files: report.xml | |
env: ci |