Reduce time of write-schema by at least 5%, work around intermittent test on MacOS
#583
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
| # This is a basic workflow to help you get started with Actions | |
| name: CI | |
| # Controls when the action will run. Triggers the workflow on push or pull request | |
| # events but only for the master branch | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| defaults: | |
| run: | |
| shell: bash # Implies `set -eo pipefail`, among other things. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell | |
| env: | |
| CI: 1 | |
| jobs: | |
| build-x86_64-linux: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| submodules: recursive | |
| - uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: true | |
| - uses: cachix/install-nix-action@526118121621777ccd86f79b04685a9319637641 # 31.3.30 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| extra_nix_config: | | |
| substituters = https://cache.nixos.org https://mzabani.cachix.org https://cache.iog.io | |
| trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= mzabani.cachix.org-1:wnkKakfl+rbT7zTtV1P1tAtjBTuh6GQVX7LfSd9sMbA= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
| - uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # v12 | |
| with: | |
| name: mzabani | |
| skipPush: false | |
| authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
| signingKey: ${{ secrets.CACHIX_SIGNING_KEY }} | |
| # Wish this could be done, but there's a permissions problem. See https://github.com/actions/cache/issues/133 | |
| # - name: Nix Store Caching | |
| # uses: actions/cache@v2 | |
| # with: | |
| # path: /nix/ | |
| # key: ${{ runner.os }}-build | |
| - name: Build statically linked codd | |
| run: nix-build --no-out-link -A coddexe | |
| - name: Build statically linked codd's tests | |
| run: nix-build --no-out-link -A coddtests | |
| - name: Build statically linked benchmarks | |
| run: nix-build --no-out-link -A coddbenchmarks | |
| - name: Build executable used for installer | |
| run: nix-build --no-out-link ./nix/install-codd-nixpkgs.nix -A codd | |
| - name: Install codd with nix-env and uninstall it | |
| run: | | |
| nix-env -f ./nix/install-codd-nixpkgs.nix -iA codd | |
| codd --help | |
| nix-env --uninstall codd | |
| - name: Testing install script posix compatibility | |
| run: | | |
| nix-env -iA shellcheck -f ./nix/nixpkgs.nix | |
| shellcheck --shell=sh nix/install-codd.sh | |
| - name: Run tests | |
| run: | | |
| echo "Running tests that don't depend on a database" | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb | |
| # Postgres-version dependent tests for each possible version next | |
| # We test the last version with the vanilla nixpkgs-built derivation, | |
| # not the IOHK one. We assume differences in the codebase regarding different | |
| # postgres versions aren't enough to make it worth testing every version here too. | |
| nix-env -iA concurrently -f ./nix/nixpkgs.nix | |
| concurrently -g --timings --names pg16Nixpkgs,pg15,pg14,pg13 \ | |
| 'scripts/ci/run-tests-and-annotate-with-error.sh local/pg16Nixpkgs-tests.txt nix-build ./nix/install-codd-nixpkgs.nix --no-out-link -A coddWithCheck' \ | |
| 'scripts/ci/run-tests-and-annotate-with-error.sh local/pg15-tests.txt nix-build --no-out-link -A testsPg15' \ | |
| 'scripts/ci/run-tests-and-annotate-with-error.sh local/pg14-tests.txt nix-build --no-out-link -A testsPg14' \ | |
| 'scripts/ci/run-tests-and-annotate-with-error.sh local/pg13-tests.txt nix-build --no-out-link -A testsPg13' | |
| echo "Running system resource usage tests" | |
| nix-build --no-out-link -A testsSystemResources | |
| - name: Run benchmarks | |
| run: nix-shell -A shellForCITests ./default.nix --run "run benchmarks --nix" | |
| - name: Build codd's library's haddocks | |
| run: nix-build --no-out-link -A coddhaddocks | |
| - name: Build codd's docker image | |
| run: nix-build --no-out-link -A dockerImage | |
| build-aarch64-darwin: | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| submodules: recursive | |
| - name: Recover disk space | |
| run: | | |
| df -h | |
| ls /Applications | |
| brew uninstall google-chrome | |
| sudo rm -rf /Users/runner/Library/Android | |
| sudo rm -rf /Applications/Xcode* | |
| sudo rm -rf /Applications/Python* | |
| ls /Applications | |
| df -h | |
| - uses: cachix/install-nix-action@526118121621777ccd86f79b04685a9319637641 # 31.3.30 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| extra_nix_config: | | |
| substituters = https://cache.nixos.org https://mzabani.cachix.org https://cache.iog.io | |
| trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= mzabani.cachix.org-1:wnkKakfl+rbT7zTtV1P1tAtjBTuh6GQVX7LfSd9sMbA= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
| - uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # v12 | |
| with: | |
| name: mzabani | |
| skipPush: false | |
| authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
| signingKey: ${{ secrets.CACHIX_SIGNING_KEY }} | |
| - name: List locales | |
| run: locale -a | |
| - name: Print some possibly useful limits | |
| run: | | |
| # According to https://doc.owncloud.com/server/next/admin_manual/troubleshooting/path_filename_length.html | |
| # Macs do have an undocumented limit of 1024 bytes for file paths. | |
| # If this is true, then it can explain some not-so-occasional test failures | |
| # we see for Mac. So we print this here, and a few other interesting limits. | |
| getconf NAME_MAX / | |
| getconf PATH_MAX / | |
| ulimit -n # Max number of open file descriptors | |
| # Statically linking in macOS seems hard at this time. Also, app bundles seem relatively easy to produce | |
| # and are a standard for macOS app distribution. | |
| - name: Build codd without static linking | |
| run: nix-build --no-out-link -A coddexe | |
| - name: Build codd's tests | |
| run: nix-build --no-out-link -A coddtests | |
| - name: Run tests | |
| run: | | |
| echo "Running tests that don't depend on a database" | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 1' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 2' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 3' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 4' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 5' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 6' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 7' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 8' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 9' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 10' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 11' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 12' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 13' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 14' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 15' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 16' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 17' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 18' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 19' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 20' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 21' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 22' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 23' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 24' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 25' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 26' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 27' | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/tests-no-db.txt nix-build --no-out-link -A testsNoDb --argstr hspecArgs '--match Writing --seed 28' | |
| # Postgres-version dependent tests for each possible version next | |
| # We test the last version with the vanilla nixpkgs-built derivation, | |
| # not the IOHK one. We assume differences in the codebase regarding different | |
| # postgres versions aren't enough to make it worth testing every version here too. | |
| # We don't run these concurrently because Nix does not have a sandbox in Macs, so it's | |
| # not worth the risk. | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/pg16Nixpkgs-tests.txt nix-build ./nix/install-codd-nixpkgs.nix --no-out-link -A coddWithCheck | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/pg15-tests.txt nix-build --no-out-link -A testsPg15 | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/pg14-tests.txt nix-build --no-out-link -A testsPg14 | |
| scripts/ci/run-tests-and-annotate-with-error.sh local/pg13-tests.txt nix-build --no-out-link -A testsPg13 | |
| - name: Create macOS app bundle | |
| run: | | |
| nix-build -A darwinAppBundle | |
| unzip -l result/codd.zip | |
| unzip result/codd.zip -d extracted-bundle | |
| ./extracted-bundle/codd.app/Contents/MacOS/codd --help # A smoke test | |
| - name: Install codd with nix-env and uninstall it | |
| run: | | |
| nix-env -f ./nix/install-codd-nixpkgs.nix -iA codd | |
| codd --help | |
| nix-env --uninstall codd | |