witch/.github/workflows/workflow.yaml

130 lines
3.6 KiB
YAML
Raw Normal View History

2022-09-08 16:51:54 +03:00
name: Workflow
2020-11-14 19:54:45 +03:00
on:
2022-09-08 16:46:05 +03:00
push: null
2020-11-14 20:22:08 +03:00
release:
types:
- created
2022-09-08 16:55:50 +03:00
2022-09-08 16:58:00 +03:00
jobs:
2022-09-08 16:47:46 +03:00
cabal:
runs-on: ubuntu-latest
name: Cabal
steps:
- uses: actions/checkout@v3
- run: cabal check
2022-09-08 16:58:00 +03:00
2022-09-08 16:47:00 +03:00
hlint:
runs-on: ubuntu-latest
name: HLint
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/hlint-setup@v2
- uses: haskell/actions/hlint-run@v2
with:
fail-on: status
2022-09-08 16:58:00 +03:00
ormolu:
runs-on: ubuntu-latest
name: Ormolu
steps:
- uses: actions/checkout@v3
- uses: mrkkrp/ormolu-action@v7
2022-09-08 16:51:54 +03:00
build:
2020-11-14 19:54:45 +03:00
strategy:
2020-11-14 19:55:42 +03:00
matrix:
2020-11-14 23:04:14 +03:00
include:
2022-11-16 02:22:07 +03:00
- { platform: ubuntu, ghc: 9.4.3 }
2022-11-16 02:21:45 +03:00
- { platform: ubuntu, ghc: 9.2.5 }
- { platform: ubuntu, ghc: 9.0.2 }
2022-11-16 02:22:07 +03:00
- { platform: macos, ghc: 9.4.3 }
- { platform: windows, ghc: 9.4.3 }
2022-01-11 15:36:00 +03:00
- { platform: ubuntu, ghc: 8.10.7 }
- { platform: ubuntu, ghc: 8.8.4 }
- { platform: ubuntu, ghc: 8.6.5 }
- { platform: ubuntu, ghc: 8.4.4 }
- { platform: ubuntu, ghc: 8.2.2 }
runs-on: ${{ matrix.platform }}-latest
name: GHC ${{ matrix.ghc }} on ${{ matrix.platform }}
2020-11-14 19:54:45 +03:00
steps:
2022-09-08 16:58:00 +03:00
- uses: actions/checkout@v3
2022-01-11 15:36:00 +03:00
2022-09-08 16:59:47 +03:00
- run: mkdir artifact
2022-01-11 15:36:00 +03:00
- id: artifact
2022-09-08 16:59:47 +03:00
run: echo '::set-output name=directory::artifact/${{ matrix.platform }}-${{ matrix.ghc }}'
- run: mkdir ${{ steps.artifact.outputs.directory }}
2022-01-11 15:36:00 +03:00
2020-11-14 19:54:45 +03:00
- id: setup-haskell
2022-09-08 16:58:00 +03:00
uses: haskell/actions/setup@v2
2020-11-14 19:54:45 +03:00
with:
ghc-version: ${{ matrix.ghc }}
2022-01-11 15:36:00 +03:00
2022-09-09 22:39:19 +03:00
- run: ghc-pkg list
- run: cabal configure --enable-tests --flags pedantic --jobs
2022-01-11 15:36:00 +03:00
2022-09-08 17:05:47 +03:00
- run: cat cabal.project.local
- run: cp cabal.project.local ${{ steps.artifact.outputs.directory }}
2022-01-11 15:36:00 +03:00
- run: cabal freeze
- run: cat cabal.project.freeze
2022-09-08 17:05:47 +03:00
- run: cp cabal.project.freeze ${{ steps.artifact.outputs.directory }}
- uses: actions/cache@v3
2020-11-14 19:54:45 +03:00
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
2022-01-11 15:36:00 +03:00
key: ${{ matrix.platform }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: ${{ matrix.platform }}-${{ matrix.ghc }}-
2022-09-08 17:05:47 +03:00
- run: cabal build --only-download
- run: cabal build --only-dependencies
2022-01-11 15:36:00 +03:00
2022-09-08 17:05:47 +03:00
- run: cabal build
2022-01-11 15:36:00 +03:00
2022-09-08 17:05:47 +03:00
- run: cabal run -- witch-test-suite
2022-09-08 16:59:47 +03:00
2022-01-11 15:36:00 +03:00
- run: cabal sdist --output-dir ${{ steps.artifact.outputs.directory }}
- uses: actions/upload-artifact@v3
2020-11-14 19:54:45 +03:00
with:
2022-01-11 15:36:00 +03:00
path: artifact
name: witch-${{ github.sha }}
release:
2022-09-08 16:51:54 +03:00
needs: build
2022-01-11 15:36:00 +03:00
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
2022-01-11 15:36:00 +03:00
with:
name: witch-${{ github.sha }}
path: artifact
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/gzip
asset_name: witch-${{ github.event.release.tag_name }}.tar.gz
2022-11-16 02:22:07 +03:00
asset_path: artifact/ubuntu-9.4.3/witch-${{ github.event.release.tag_name }}.tar.gz
2022-01-11 15:36:00 +03:00
upload_url: ${{ github.event.release.upload_url }}
2022-11-16 02:22:07 +03:00
- run: cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' artifact/ubuntu-9.4.3/witch-${{ github.event.release.tag_name }}.tar.gz
2022-01-11 15:36:00 +03:00
2021-05-28 21:48:31 +03:00
i386:
runs-on: ubuntu-latest
2021-05-28 21:48:31 +03:00
steps:
- uses: actions/checkout@v2
2022-09-08 16:58:00 +03:00
2021-05-28 21:48:31 +03:00
- run: docker run --rm --user 0 --volume "$PWD:$PWD" --workdir "$PWD" taylorfausak/i386-haskell@sha256:450720742fa69258c0a8589dcac28c3c6d5d34718172d935b385520f4ee9128e sh -c 'cabal update && cabal test --test-show-details direct'