diff --git a/.github/workflows/macOS.yml b/.github/workflows/cabal-mac-win.yml similarity index 51% rename from .github/workflows/macOS.yml rename to .github/workflows/cabal-mac-win.yml index 4b6f71f..82d92f2 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/cabal-mac-win.yml @@ -1,11 +1,9 @@ -name: macOS +name: Cabal (macOS and Windows) on: push: branches: - master - - ci-* - - release* paths: - '.github/workflows/macOS.yml' - 'tasty-silver.cabal' @@ -26,10 +24,13 @@ defaults: jobs: build-and-test: - runs-on: macos-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: { os: [macos-latest, windows-latest] } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive @@ -38,26 +39,35 @@ jobs: with: ghc-version: latest cabal-version: latest + cabal-update: true - name: Configure the build plan run: | - cabal update cabal configure -O1 --enable-tests - - uses: actions/cache@v3 - name: Cache dependencies + - name: Restore cached dependencies + uses: actions/cache/restore@v3 id: cache + env: + key: ${{ runner.os }}-cabal-${{ steps.setup-haskell.outputs.cabal-version }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }} with: - path: | - ${{ steps.setup-haskell.outputs.cabal-store }} + path: ${{ steps.setup-haskell.outputs.cabal-store }} # The file `plan.json` contains the build information. - key: macOS-${{ hashFiles('**/plan.json') }} + key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} + restore-keys: ${{ env.key }}- - name: Install dependencies - if: ${{ !steps.cache.outputs.cache-hit }} + if: ${{ steps.cache.outputs.cache-hit != 'true' }} run: | cabal build --only-dependencies + - name: Cache dependencies + uses: actions/cache/save@v3 + if: ${{ steps.cache.outputs.cache-hit != 'true' }} + with: + path: ${{ steps.setup-haskell.outputs.cabal-store }} + key: ${{ steps.cache.outputs.cache-primary-key }} + - name: Build run: | cabal build diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 3f0e40a..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: windows - -on: - push: - branches: - - master - - ci-* - - release* - paths: - - '.github/workflows/windows.yml' - - 'tasty-silver.cabal' - - 'Setup.hs' - - 'Test/**.hs' - - 'tests/**' - pull_request: - paths: - - '.github/workflows/windows.yml' - - 'tasty-silver.cabal' - - 'Setup.hs' - - 'Test/**.hs' - - 'tests/**' - -defaults: - run: - shell: bash - -jobs: - build-and-test: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - uses: haskell-actions/setup@v2 - id: setup-haskell - with: - ghc-version: latest - cabal-version: latest - - - name: Configure the build plan - run: | - cabal update - cabal configure -O1 --enable-tests - - - uses: actions/cache@v3 - name: Cache dependencies - id: cache - with: - path: | - ${{ steps.setup-haskell.outputs.cabal-store }} - # The file `plan.json` contains the build information. - key: windows-${{ hashFiles('**/plan.json') }} - - - name: Install dependencies - if: ${{ !steps.cache.outputs.cache-hit }} - run: | - cabal build --only-dependencies - - - name: Build - run: | - cabal build - - - name: Test - run: | - cabal test --test-show-details=direct --test-options=-i