From 9d6f3bfe8ca6fbcba4a7d5a87c108c136a3e667e Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Mon, 20 May 2024 14:25:11 +0800 Subject: [PATCH] fix ci --- .github/workflows/ci.yml | 81 +++++++++++++++++++++++++++++++++ .github/workflows/ubuntuCI.yml | 53 ---------------------- 23 | 83 ++++++++++++++++++++++++++++++++++ Z-IO.cabal | 3 -- 4 files changed, 164 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/ubuntuCI.yml create mode 100644 23 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..aa0a143 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +on: [push, pull_request] +name: ci + +jobs: + build: + name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + ghc-version: ["9.2", "9.4"] + cabal: ["3.8"] + avx_flag: ["", '--constraint="Z-Data +use-avx2"'] + env: + CONFIG: "--enable-tests --enable-benchmarks" + + steps: + - name: CPU info + if: runner.os == 'Linux' + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + apt-get install cpuid + cpuid + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install cpufetch + cpufetch + fi + + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Set up GHC ${{ matrix.ghc-version }} + uses: haskell-actions/setup@v2 + id: setup + with: + ghc-version: ${{ matrix.ghc-version }} + cabal-version: ${{ matrix.cabal }} + cabal-update: true + + - name: Configure the build + run: | + cabal configure ${{ matrix.avx_flag }} $CONFIG + cabal build all --dry-run + + - name: Restore cached dependencies + uses: actions/cache/restore@v3 + id: cache + env: + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} + with: + path: ${{ steps.setup.outputs.cabal-store }} + key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} + restore-keys: ${{ env.key }}- + + - name: Install dependencies + # If we had an exact cache hit, the dependencies will be up to date. + if: steps.cache.outputs.cache-hit != 'true' + run: cabal build all --only-dependencies + + # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. + - name: Save cached dependencies + uses: actions/cache/save@v3 + # If we had an exact cache hit, trying to save the cache would error because of key clash. + if: steps.cache.outputs.cache-hit != 'true' + with: + path: ${{ steps.setup.outputs.cabal-store }} + key: ${{ steps.cache.outputs.cache-primary-key }} + + - name: Build + run: cabal build $CONFIG + + - name: Run tests + # https://github.com/haskell/cabal/issues/7883 + run: cabal test --enable-tests --test-show-details=direct + + - run: | + cabal haddock + cabal check + cabal sdist diff --git a/.github/workflows/ubuntuCI.yml b/.github/workflows/ubuntuCI.yml deleted file mode 100644 index 8f9a4ac..0000000 --- a/.github/workflows/ubuntuCI.yml +++ /dev/null @@ -1,53 +0,0 @@ -on: [push, pull_request] -name: ubuntu-ci -jobs: - build: - runs-on: ubuntu-20.04 - strategy: - matrix: - ghc: ['9.2'] - cabal: ['3.6'] - avx_flag: ['', '--constraint="Z-Data +use-avx2"'] - name: Haskell GHC ${{ matrix.ghc }} - env: - CONFIG: "--enable-tests --enable-benchmarks" - steps: - - - name: CPU info - run: | - sudo apt-get install cpuid - cpuid - - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Setup Haskell - uses: haskell/actions/setup@v1 - id: setup-haskell-cabal # <--- give it a name for later cache usage - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - - - run: | - cabal update - cabal freeze ${{ matrix.avx_flag }} - - - uses: actions/cache@v2 - with: - path: | - ${{ steps.setup-haskell-cabal.outputs.cabal-store }} - dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.ghc }}- - - - run: | - cabal configure ${{ matrix.avx_flag }} $CONFIG - cabal build $CONFIG - - run: | - cabal test --test-show-details=direct - - run: | - cabal haddock - cabal check - cabal sdist diff --git a/23 b/23 new file mode 100644 index 0000000..e0bf6da --- /dev/null +++ b/23 @@ -0,0 +1,83 @@ +on: [push, pull_request] +name: ci + +jobs: + build: + name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + ghc-version: ["9.2", "9.4"] + cabal: ["3.8"] + avx_flag: ["", '--constraint="Z-Data +use-avx2"'] + env: + CONFIG: "--enable-tests --enable-benchmarks" + + steps: + - name: CPU info + if: runner.os == 'Linux' + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + apt-get install cpuid + cpuid + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install cpufetch + cpufetch + fi + - name: CPU info + if: runner.os == 'macOS' + run: | + + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Set up GHC ${{ matrix.ghc-version }} + uses: haskell-actions/setup@v2 + id: setup + with: + ghc-version: ${{ matrix.ghc-version }} + cabal-version: ${{ matrix.cabal }} + cabal-update: true + + - name: Configure the build + run: | + cabal configure ${{ matrix.avx_flag }} $CONFIG + cabal build all --dry-run + + - name: Restore cached dependencies + uses: actions/cache/restore@v3 + id: cache + env: + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} + with: + path: ${{ steps.setup.outputs.cabal-store }} + key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} + restore-keys: ${{ env.key }}- + + - name: Install dependencies + # If we had an exact cache hit, the dependencies will be up to date. + if: steps.cache.outputs.cache-hit != 'true' + run: cabal build all --only-dependencies + + # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. + - name: Save cached dependencies + uses: actions/cache/save@v3 + # If we had an exact cache hit, trying to save the cache would error because of key clash. + if: steps.cache.outputs.cache-hit != 'true' + with: + path: ${{ steps.setup.outputs.cabal-store }} + key: ${{ steps.cache.outputs.cache-primary-key }} + + - name: Build + run: cabal build $CONFIG + + - name: Run tests + run: cabal test --test-show-details=direct + + - run: | + cabal haddock + cabal check + cabal sdist diff --git a/Z-IO.cabal b/Z-IO.cabal index d11ccfb..2dce01d 100644 --- a/Z-IO.cabal +++ b/Z-IO.cabal @@ -389,9 +389,6 @@ test-suite Z-IO-Test Z.IO.ProcessSpec Z.IO.ResourceSpec - if os(linux) - other-modules: Z.IO.Network.IPCSpec - ghc-options: -threaded default-language: Haskell2010 build-tool-depends: hspec-discover:hspec-discover ==2.*