diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cirrus.yml | 39 | ||||
-rw-r--r-- | examples/gh-ci.yml | 77 |
2 files changed, 116 insertions, 0 deletions
diff --git a/examples/cirrus.yml b/examples/cirrus.yml new file mode 100644 index 0000000..6105386 --- /dev/null +++ b/examples/cirrus.yml @@ -0,0 +1,39 @@ +freebsd_instance: + image_family: freebsd-13-0 + +build_task: + env: + CONFIG: "--enable-tests --enable-benchmarks -fwith_mpd -fwith_xft" + + # caches the freebsd package downloads + # saves probably just a couple of seconds, but hey... + pkg_cache: + folder: /var/cache/pkg + + install_script: + - pkg install -y ghc hs-hlint xorg-libraries hs-cabal-install git autoconf libmpdclient pkgconf libXft hs-hspec-discover + + # cache the hackage index file and downloads which are + # cabal v2-update downloads an incremental update, so we don't need to keep this up2date + packages_cache: + # warning: don't use ~/.cabal here, this will break the cache + folder: /.cabal/packages + reupload_on_changes: false + + # cache the dependencies built by cabal + # they have to be uploaded on every change to make the next build fast + store_cache: + # warning: don't use ~/.cabal here, this will break the cache + folder: /.cabal/store + fingerprint_script: cat xmobar.cabal + reupload_on_changes: true + + build_script: + - cabal v2-update + - timeout 1800 cabal v2-build -j4 $CONFIG || (($?==124)) + + lint_script: + - hlint src + + test_script: + - cabal v2-test -j4 $CONFIG diff --git a/examples/gh-ci.yml b/examples/gh-ci.yml new file mode 100644 index 0000000..e720e9e --- /dev/null +++ b/examples/gh-ci.yml @@ -0,0 +1,77 @@ +name: Haskell CI (PRs) + +on: + pull_request: + branches: [ master ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + cabal: ["3.2"] + ghc: ["8.4", "8.6", "8.8.3", "8.10"] + env: + CONFIG: "--enable-tests --enable-benchmarks -fall_extensions" + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-haskell@v1 + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} + + - name: Cache + uses: actions/cache@v1 + env: + cache-name: cache-cabal + with: + path: ~/.cabal + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y xorg-dev + sudo apt-get install -y libasound2-dev libxpm-dev libmpd-dev libxrandr-dev + sudo apt-get install -y happy c2hs hspec-discover + + - name: Install dependencies + run: | + cabal update + cabal build --dependencies-only $CONFIG + + - name: Build + run: cabal build $CONFIG + + - name: Run hlint + run: | + wget https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh + sh ./travis.sh src + - name: Run tests + run: cabal test + + # build-freebsd: + # runs-on: macos-latest + # env: + # CONFIG: "--enable-tests --enable-benchmarks -fwith_xft -fwith_mpd" + + # steps: + # - uses: actions/checkout@v2 + + # - name: Install dependencies + # uses: vmactions/freebsd-vm@v0.1.5 + # with: + # usesh: true + # prepare: pkg install -y ghc hs-hlint xorg-libraries hs-cabal-install git autoconf + # run: | + # cabal update + # cabal build --dependencies-only $CONFIG + # cabal build $CONFIG + # hlint + # cabal test |