-
Notifications
You must be signed in to change notification settings - Fork 95
CICD: implement tests in GitHub Actions #1657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
onetechnical
merged 14 commits into
algorand:main
from
onetechnical:github-actions-tests
Jun 26, 2025
+240
−2
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f827aa7
First pass of tests in GitHub Actions
onetechnical 789a50d
Temporarily disable linting
onetechnical 5124225
Remove fakepackage target
onetechnical 40d5cdc
Remove fakepackage step, as it's a no-op
onetechnical 7114dc1
Add docker-compose install
onetechnical eac6716
WIP - start stripping things and re-enable lint
onetechnical 9f1c8a5
Fetch full history so golangci-lint can parse
onetechnical 1333b77
Remove fakepackage call from circleci
onetechnical e748bd8
Use updated rel nightly tag and binaries for PR tests
onetechnical d701490
Simplify some handling
onetechnical 1f87c60
Modernize slack configuration and format cleanup
onetechnical 6710e5e
Formatting
onetechnical fa2ab24
No submodules anymore
onetechnical 081d3e0
Merge branch 'main' into github-actions-tests
onetechnical File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| name: CI - Nightly Test Suite | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "37 3 * * *" # Run at 3:37 AM UTC daily | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| GO_VERSION: "1.23.3" | ||
| CI_E2E_FILENAME: "rel-nightly" | ||
| CHANNEL: nightly | ||
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
|
|
||
| jobs: | ||
| test_nightly: | ||
| runs-on: "ubuntu-24.04" | ||
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:13.11-bullseye | ||
| env: | ||
| POSTGRES_PASSWORD: pgpass | ||
| POSTGRES_USER: pguser | ||
| POSTGRES_DB: mydb | ||
| ports: | ||
| - 5555:5432 | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Fetch full history | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.x' | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt update | ||
| sudo NEEDRESTART_MODE=a apt -y install python3 python3-pip python3-setuptools python3-wheel libboost-math-dev libffi-dev | ||
| pip3 install -r misc/requirements.txt | ||
| pip3 install e2e_tests/ | ||
| echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
| echo "/usr/local/go/bin" >> $GITHUB_PATH | ||
| - name: Install golangci-lint | ||
| run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0 | ||
| - name: Check formatting | ||
| run: test -z "$(go fmt ./...)" | ||
| - name: Run linter | ||
| run: make lint | ||
| - name: Run build check | ||
| run: make check | ||
| - name: Set up test environment | ||
| run: | | ||
| echo 'TEST_PG=host=localhost user=pguser password=pgpass dbname=mydb port=5555 sslmode=disable' >> $GITHUB_ENV | ||
| echo 'TEST_FLAG=-p 1' >> $GITHUB_ENV | ||
| - name: Run tests | ||
| run: make test | ||
| timeout-minutes: 15 | ||
| - name: Run test-generate | ||
| run: make test-generate | ||
| - name: Install go-algorand ${{ env.CHANNEL }} binaries | ||
| run: | | ||
| wget https://raw.githubusercontent.com/algorand/go-algorand/rel/stable/cmd/updater/update.sh && chmod 744 update.sh | ||
| ./update.sh -i -c ${{ env.CHANNEL }} -n -d ./ -p /usr/local/go/bin | ||
| export GOPATH=/usr/local/go/ | ||
| - name: Run e2e tests (nightly) | ||
| run: | | ||
| make e2e | ||
| make e2e-filter-test | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage.txt | ||
| flags: nightly | ||
| name: codecov-nightly | ||
| - name: Notify Slack on failure | ||
| if: failure() && env.SLACK_WEBHOOK != '' | ||
| uses: slackapi/slack-github-action@v2.1.0 | ||
| with: | ||
| webhook: ${{ secrets.SLACK_WEBHOOK }} | ||
| webhook-type: webhook-trigger | ||
| payload: | | ||
| { | ||
| "text": "🚨 Indexer Failure Alert", | ||
| "blocks": [ | ||
| { | ||
| "type": "section", | ||
| "text": { | ||
| "type": "mrkdwn", | ||
| "text": "test_nightly Job Failure:\n* Branch: `${{ github.ref_name }}`\n* Run URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| indexer_vs_algod_nightly: | ||
| runs-on: "ubuntu-24.04" | ||
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 0 # Fetch full history | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.x' | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt update | ||
| sudo NEEDRESTART_MODE=a apt -y install python3 python3-pip python3-setuptools python3-wheel libboost-math-dev libffi-dev docker-compose | ||
| pip3 install -r misc/requirements.txt | ||
| pip3 install e2e_tests/ | ||
| echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
| echo "/usr/local/go/bin" >> $GITHUB_PATH | ||
| - name: Run indexer vs algod tests | ||
| run: make indexer-v-algod | ||
| - name: Notify Slack on failure | ||
| if: failure() && env.SLACK_WEBHOOK != '' | ||
| uses: slackapi/slack-github-action@v2.1.0 | ||
| with: | ||
| webhook: ${{ secrets.SLACK_WEBHOOK }} | ||
| webhook-type: webhook-trigger | ||
| payload: | | ||
| { | ||
| "text": "🚨 Indexer Failure Alert", | ||
| "blocks": [ | ||
| { | ||
| "type": "section", | ||
| "text": { | ||
| "type": "mrkdwn", | ||
| "text": "indexer_vs_algod_nightly Job Failure:\n* Branch: `${{ github.ref_name }}`\n* Run URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| name: CI - Test Suite | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| env: | ||
| GO_VERSION: "1.23.3" | ||
| # A stable environment for PRs. | ||
| # Set CHANNEL to nightly and update CI_E2E_FILENAME when adding a new feature. | ||
| # Change back to stable once the new feature is released. | ||
| CI_E2E_FILENAME: "rel-nightly" | ||
| CHANNEL: nightly | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:13.11-bullseye | ||
| env: | ||
| POSTGRES_PASSWORD: pgpass | ||
| POSTGRES_USER: pguser | ||
| POSTGRES_DB: mydb | ||
| ports: | ||
| - 5555:5432 | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Fetch full history | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.x' | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo NEEDRESTART_MODE=a apt-get -y install python3 python3-pip python3-setuptools python3-wheel libboost-math-dev libffi-dev docker-compose | ||
| pip3 install -r misc/requirements.txt | ||
| pip3 install e2e_tests/ | ||
| - name: Install golangci-lint | ||
| run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0 | ||
| - name: Check formatting | ||
| run: test -z "$(go fmt ./...)" | ||
| - name: Run linter | ||
| run: make lint | ||
| - name: Run build check | ||
| run: make check | ||
| - name: Set up test environment | ||
| run: | | ||
| echo 'TEST_PG=host=localhost user=pguser password=pgpass dbname=mydb port=5555 sslmode=disable' >> $GITHUB_ENV | ||
| echo 'TEST_FLAG=-p 1' >> $GITHUB_ENV | ||
| - name: Run tests | ||
| run: make test | ||
| timeout-minutes: 15 | ||
| - name: Run test-generate | ||
| run: make test-generate | ||
| - name: Install go-algorand ${{ env.CHANNEL }} binaries | ||
| run: | | ||
| wget https://raw.githubusercontent.com/algorand/go-algorand/rel/stable/cmd/updater/update.sh && chmod 744 update.sh | ||
| ./update.sh -i -c ${{ env.CHANNEL }} -n -d ./ -p /usr/local/go/bin | ||
| export GOPATH=/usr/local/go/ | ||
| - name: Run e2e tests | ||
| run: | | ||
| make e2e | ||
| make e2e-filter-test | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage.txt | ||
| flags: unittests | ||
| name: codecov-umbrella |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.