Fix heighliner Github action and speed up docker actions. #9526
Workflow file for this run
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
| name: Sims | |
| # Sims workflow runs multiple types of simulations (nondeterminism, import-export, after-import, multi-seed-short) | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| # GOGC=50 sets the go garbage collector's target heap growth to 50% above the live heap, | |
| # so it collects once the heap grows to 1.5x the live set (default is 100%, i.e. 2x). | |
| # It should help prevent these sims from using all the runner's memory (and getting killed). | |
| env: | |
| LD_LIBRARY_PATH: /usr/local/lib:/usr/local/lib/x86_64-linux-gnu | |
| GOMEMLIMIT: 6GiB | |
| GOGC: 50 | |
| # Set concurrency for this workflow to cancel in-progress jobs if retriggered. | |
| # The github.ref is only available when triggered by a PR so fall back to github.run_id for other cases. | |
| # The github.run_id is unique for each run, giving each such invocation it's own unique concurrency group. | |
| # Basically, if you push to a PR branch, jobs that are still running for that PR will be cancelled. | |
| # But jobs started because of a merge to main or a release tag push are not cancelled. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| setup: | |
| if: "!contains(github.event.head_commit.message, 'skip-sims')" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: technote-space/get-diff-action@v6.1.2 | |
| with: | |
| PATTERNS: | | |
| **/**.go | |
| go.mod | |
| go.sum | |
| .github/workflows/sims.yml | |
| sims.mk | |
| SET_ENV_NAME_INSERTIONS: 1 | |
| SET_ENV_NAME_LINES: 1 | |
| - name: Define Variables | |
| id: def-vars | |
| run: | | |
| file_prefix="sim-test-${GITHUB_SHA:0:7}-${GITHUB_RUN_ATTEMPT}" | |
| echo "Setting output: file-prefix=$file_prefix" | |
| echo "file-prefix=$file_prefix" >> "$GITHUB_OUTPUT" | |
| outputs: | |
| should-run: ${{ env.GIT_DIFF }} | |
| file-prefix: ${{ steps.def-vars.outputs.file-prefix }} | |
| build-linux: | |
| needs: setup | |
| if: needs.setup.outputs.should-run | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Output setup | |
| run: | | |
| echo " should-run: [${{ needs.setup.outputs.should-run }}]" | |
| echo "file-prefix: [${{ needs.setup.outputs.file-prefix }}]" | |
| - name: Setup build environment | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev wget curl build-essential cmake gcc sqlite3 | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Build provenanced | |
| run: make build | |
| - name: Provenanced version | |
| run: build/provenanced version --long | |
| go-test-multi-db: | |
| # These are tests that use go test to run (see sims.mk), and that we want to test using different database backends. | |
| needs: [setup,build-linux] | |
| if: needs.setup.outputs.should-run | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # The test-sim-simple test is pretty quick and should be able to identify glaring problems. | |
| # The test-sim-benchmark is handy to have for each db type. | |
| test: ["simple", "benchmark","import-export", "multi-seed-short", "after-import"] | |
| db-backend: ["goleveldb"] | |
| os: ["ubuntu-latest"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Define test-logs | |
| id: test-logs | |
| run: | | |
| test_logs="${{ needs.setup.outputs.file-prefix }}-${{ matrix.test }}-${{ matrix.db-backend }}-${{ matrix.os }}" | |
| echo "Setting output: test-logs=$test_logs" | |
| echo "test-logs=$test_logs" >> "$GITHUB_OUTPUT" | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Test | |
| run: | | |
| set -x | |
| export DB_BACKEND=${{ matrix.db-backend }} | |
| make test-sim-${{ matrix.test }} | tee "${{ steps.test-logs.outputs.test-logs }}.txt" | |
| exit "${PIPESTATUS[0]}" | |
| - uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: ${{ steps.test-logs.outputs.test-logs }} | |
| path: ${{ steps.test-logs.outputs.test-logs }}.txt | |
| go-test-single-db: | |
| # These are tests that use go test to run (see sims.mk), and that we don't care about testing using different database backends. | |
| needs: [setup,build-linux] | |
| if: needs.setup.outputs.should-run | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # The test-sim-nondeterminism test hard-codes the db backend to use memdb. | |
| # The test-sim-benchmark-invariants test can use different db backends, but to save resources, is down here. | |
| test: ["nondeterminism", "benchmark-invariants"] | |
| os: ["ubuntu-latest"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Define test-logs | |
| id: test-logs | |
| run: | | |
| test_logs="${{ needs.setup.outputs.file-prefix }}-${{ matrix.test }}-${{ matrix.os }}" | |
| echo "Setting output: test-logs=$test_logs" | |
| echo "test-logs=$test_logs" >> "$GITHUB_OUTPUT" | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Test | |
| run: | | |
| set -x | |
| make test-sim-${{ matrix.test }} | tee "${{ steps.test-logs.outputs.test-logs }}.txt" | |
| exit "${PIPESTATUS[0]}" | |
| - uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: ${{ steps.test-logs.outputs.test-logs }} | |
| path: ${{ steps.test-logs.outputs.test-logs }}.txt | |
| # Sim tests that are not run in here: | |
| # test-sim-multi-seed-long: runsim | |
| # The short version does 50 blocks and takes 30-40 minutes. The long one does 500 blocks. Way too long. | |
| # test-sim-custom-genesis-multi-seed: runsim | |
| # This one requires a genesis file to be created, and I don't feel like doing that right now. | |
| # test-sim-custom-genesis-fast: | |
| # Same as test-sim-custom-genesis-multi-seed. | |
| # test-sim-profile: | |
| # This is the exact same thing as test-sim-benchmark except with a couple extra output files. | |
| # Unless I add an upload for them, it's not worth doing it again. |