diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1540092ab67..9d1eb7be0ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,26 +97,33 @@ jobs: # Test network packages - name: ntp-client [test] - run: cabal run ntp-client:test + run: cabal run ntp-client:test -- +RTS -maxN2 -RTS + + - name: monoidal-synchronisation [test] + run: cabal run monoidal-synchronisation:test -- +RTS -maxN2 -RTS - name: network-mux [test] + # TODO: issue #4635 to enable `+RTS -N` run: cabal run network-mux:test - name: ourobors-network-testing [test] - run: cabal run ouroboros-network-testing:test + run: cabal run ouroboros-network-testing:test -- +RTS -maxN2 -RTS - name: ourobors-network-framework [test] + # TODO: enable `+RTS -N` run: cabal run ouroboros-network-framework:test + # TODO: run CDDL + - name: ouroboros-network-protocols [test] - run: cabal run ouroboros-network-protocols:test + run: cabal run ouroboros-network-protocols:test -- +RTS -maxN2 -RTS # We don't run cddl in GitHub actions (only on Hydra). # - name: ouroboros-network-protocols [cddl] # run: cabal run ouroboros-network-protocols-test:cddl - name: ouroboros-network [test] - run: cabal run ouroboros-network:test + run: cabal run ouroboros-network:test -- +RTS -maxN2 -RTS # Uncomment the following back in for debugging. Remember to launch a `pwsh` from # the tmux session to debug `pwsh` issues. And be reminded that the `/msys2` and diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0e9ecca448d..220540f1c79 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,7 +11,6 @@ on: jobs: check-git-dependencies: name: Check git dependencies - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} runs-on: ubuntu-latest defaults: run: @@ -24,7 +23,6 @@ jobs: check-changelogs: name: Check changelogs - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} runs-on: ubuntu-latest defaults: run: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000000..3f1c71182a7 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,160 @@ +name: Nightly Haskell CI + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: + schedule: + - cron: 0 3 * * * + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + ghc: ["8.10.7", "9.6.2"] + os: [ubuntu-latest] + + env: + # Modify this value to "invalidate" all cabal caches. + CABAL_CACHE_VERSION: "2022-12-30" + # Modify this value to "invalidate" the cabal store cache only. + CACHE_VERSION: "20220919" + # Modify this value to "invalidate" the dist-newstyle cache only. + DIST_CACHE_VERSION: "20221122" + + steps: + + - name: Install Haskell + uses: input-output-hk/setup-haskell@v1 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: "3.10.1.0" + pacman-packages: > + mingw-w64-x86_64-pkg-config + mingw-w64-x86_64-openssl + mingw-w64-x86_64-sed + base-devel + autoconf-wrapper + autoconf + automake + libtool + make + + - name: Set up Ruby + if: runner.os == 'Linux' + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + + - name: Install cddl + if: runner.os == 'Linux' + run: | + gem install cddl -v 0.8.27 + + - uses: actions/checkout@v3 + + - name: "Configure cabal.project.local" + run: | + cp ./scripts/ci/cabal.project.nightly${{ runner.os }} cabal.project.local + + - name: Update PATH (Windows) + if: runner.os == 'Windows' + run: | + $env:PATH=("C:\msys64\mingw64\bin;{0}" -f $env:PATH) + echo "PATH=$env:PATH" >> $env:GITHUB_ENV + + - name: Update PATH (Linux) + if: runner.os == 'Linux' + run: + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Update Hackage and CHaP + run: cabal update + + - name: Record dependencies + id: record-deps + run: | + cabal build all --dry-run + cat dist-newstyle/cache/plan.json | jq -L .github/workflows/jq-install-plan | sort | uniq > dependencies.txt + + - uses: actions/cache/restore@v3 + name: "Restore cache: `cabal store`" + id: restore-cabal-store + with: + path: ${{ steps.setup-haskell.outputs.cabal-store }} + key: cache-dependencies-${{ env.CABAL_CACHE_VERSION }}-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }} + restore-keys: cache-dependencies-${{ env.CABAL_CACHE_VERSION }}-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }} + + - uses: actions/cache@v3 + name: "Cache `dist-newstyle`" + with: + path: | + dist-newstyle + !dist-newstyle/**/.git + key: cache-dist-${{ env.CABAL_CACHE_VERSION }}-${{ env.DIST_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project') }} + restore-keys: cache-dist-${{ env.CABAL_CACHE_VERSION }}-${{ env.DIST_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }} + + - name: Build dependencies + run: cabal build --only-dependencies all -j + + - uses: actions/cache/save@v3 + name: "Save cache: `cabal store`" + with: + path: ${{ steps.setup-haskell.outputs.cabal-store }} + key: cache-dependencies-${{ env.CABAL_CACHE_VERSION }}-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }} + + - name: Build projects [build] + run: cabal build all -j + + # Test network packages + + - name: ntp-client [test] + run: cabal run ntp-client:test -- +RTS -maxN2 -RTS + + - name: monoidal-synchronisation [test] + run: cabal run monoidal-synchronisation:test -- +RTS -maxN2 -RTS + + - name: network-mux [test] + # TODO: issue #4635 to enable `+RTS -N` + run: cabal run network-mux:test + + - name: ourobors-network-testing [test] + run: cabal run ouroboros-network-testing:test -- +RTS -maxN2 -RTS + + - name: ourobors-network-framework [test] + # TODO: enable `+RTS -N` + run: cabal run ouroboros-network-framework:test + + - name: ouroboros-network-protocols [test] + run: cabal run ouroboros-network-protocols:test -- +RTS -maxN2 -RTS + + - name: ouroboros-netowrk-protocols [cddl] + if: runner.os == 'Linux' + run: cabal run ouroboros-network-protocols:cddl -- +RTS -maxN2 -RTS + + - name: ouroboros-network [test] + run: cabal run ouroboros-network:test -- +RTS -maxN2 -RTS + + # Uncomment the following back in for debugging. Remember to launch a `pwsh` from + # the tmux session to debug `pwsh` issues. And be reminded that the `/msys2` and + # `/msys2/mingw64` paths are not in PATH by default for the workflow, but tmate + # will put them in. + # You may also want to run + # + # $env:PATH=("C:\Program Files\PowerShell\7;{0}" -f $env:ORIGINAL_PATH) + # + # to restore the original path. Do note that some test might need msys2 + # and will silently fail if msys2 is not in path. See the "Run tests" step. + # + # - name: Set up tmate session + # if: ${{ failure() }} + # uses: mxschmitt/action-tmate@v3 + # with: + # limit-access-to-actor: true + diff --git a/README.md b/README.md index fa03b94329a..911b7962151 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # [Ouroboros-Network][ouroboros-network] [![Haskell CI](https://img.shields.io/github/actions/workflow/status/input-output-hk/ouroboros-network/build.yml?branch=master&label=Build&style=for-the-badge)](https://github.com/input-output-hk/ouroboros-network/actions/workflows/build.yml) +[![Nightly CI](https://img.shields.io/github/actions/workflow/status/input-output-hk/ouroboros-network/nightly.yml?branch=master&label=Nightly&style=for-the-badge)](https://github.com/input-output-hk/ouroboros-network/actions/workflows/nightly.yml) [![Haddocks](https://img.shields.io/github/actions/workflow/status/input-output-hk/ouroboros-network/github-page.yml?branch=master&label=Haddocks&style=for-the-badge)](https://github.com/input-output-hk/ouroboros-network/actions/workflows/github-page.yml) [![handbook](https://img.shields.io/badge/policy-Cardano%20Engineering%20Handbook-informational?style=for-the-badge)](https://input-output-hk.github.io/cardano-engineering-handbook) diff --git a/ntp-client/ntp-client.cabal b/ntp-client/ntp-client.cabal index 94eaccad890..03898fbabcf 100644 --- a/ntp-client/ntp-client.cabal +++ b/ntp-client/ntp-client.cabal @@ -59,6 +59,7 @@ test-suite test default-language: Haskell2010 ghc-options: -Wall -Wunused-packages + -threaded executable demo-ntp-client hs-source-dirs: demo diff --git a/ouroboros-network-protocols/ouroboros-network-protocols.cabal b/ouroboros-network-protocols/ouroboros-network-protocols.cabal index 177361d8e68..53a1095072b 100644 --- a/ouroboros-network-protocols/ouroboros-network-protocols.cabal +++ b/ouroboros-network-protocols/ouroboros-network-protocols.cabal @@ -205,7 +205,8 @@ test-suite test ouroboros-network-protocols:testlib, ouroboros-network-testing ^>= 0.3 - ghc-options: -Wall + ghc-options: -threaded + -Wall -Wunused-packages test-suite cddl @@ -243,7 +244,8 @@ test-suite cddl ouroboros-network-protocols, ouroboros-network-protocols:testlib - ghc-options: -Wall + ghc-options: -threaded + -Wall -Wno-unticked-promoted-constructors -Wcompat -Wunused-packages diff --git a/ouroboros-network/test/Test/Ouroboros/Network/PeerSelection.hs b/ouroboros-network/test/Test/Ouroboros/Network/PeerSelection.hs index 32ec98f801a..1ede66baaf6 100644 --- a/ouroboros-network/test/Test/Ouroboros/Network/PeerSelection.hs +++ b/ouroboros-network/test/Test/Ouroboros/Network/PeerSelection.hs @@ -1,5 +1,4 @@ {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DerivingVia #-} @@ -175,10 +174,7 @@ tests = , testGroup "races" [ nightlyTest $ testProperty "governor no livelock" $ prop_explore_governor_nolivelock --- `IOSimPOR` is consumes too much RAM on Windows -#if !defined(mingw32_HOST_OS) - , testProperty "governor connection status" $ prop_explore_governor_connstatus -#endif + , nightlyTest $ testProperty "governor connection status" $ prop_explore_governor_connstatus ] ] --TODO: We should add separate properties to check that we do not overshoot diff --git a/scripts/ci/cabal.project.local.Linux b/scripts/ci/cabal.project.local.Linux index d1116c4c92a..66d3cb40b28 100644 --- a/scripts/ci/cabal.project.local.Linux +++ b/scripts/ci/cabal.project.local.Linux @@ -27,8 +27,9 @@ package ouroboros-network-mock package ouroboros-network-testing ghc-options: -fno-ignore-asserts -Werror +-- IPv6 tests are DISABLED package ouroboros-network-framework - flags: +ipv6 + flags: -ipv6 ghc-options: -fno-ignore-asserts -Werror package ouroboros-network-protocols diff --git a/scripts/ci/cabal.project.nightly.Linux b/scripts/ci/cabal.project.nightly.Linux new file mode 100644 index 00000000000..386b7639a1a --- /dev/null +++ b/scripts/ci/cabal.project.nightly.Linux @@ -0,0 +1,44 @@ +max-backjumps: 5000 +reorder-goals: True +tests: True +benchmarks: True + +package strict-checked-vars + flags: +checktvarinvariants +checkmvarinvariants + +package ntp-client + flags: +demo + +package network-mux + flags: +ipv6 + ghc-options: -fno-ignore-asserts -Werror + +package ouroboros-network-api + flags: +asserts + ghc-options: -fno-ignore-asserts -Werror + +package ouroboros-network-mock + ghc-options: -fno-ignore-asserts -Werror + +package ouroboros-network-testing + flags: +nightly + ghc-options: -fno-ignore-asserts -Werror + +-- IPv6 tests are DISABLED +package ouroboros-network-framework + flags: -ipv6 + ghc-options: -fno-ignore-asserts -Werror + +package ouroboros-network-protocols + flags: +cddl + ghc-options: -fno-ignore-asserts -Werror + +package ouroboros-network + ghc-options: -fno-ignore-asserts -Werror + +package cardano-ping + ghc-options: -fno-ignore-asserts -Werror + +package cardano-client + ghc-options: -fno-ignore-asserts -Werror +