Merge pull request #35 from hasufell/autoconf #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Haskell CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
hlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run hlint | |
run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s -- -r libarchive/src libarchive/mem libarchive/bench libarchive/test | |
shell: bash | |
build-cabal: | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, macOS, windows] | |
builder: ['cabal 3.6.2.0 ghc 8.10.7', 'cabal 3.10.2.0 ghc 9.2.8', 'stack 2.13.1'] | |
include: | |
- os: windows | |
shell: msys2 {0} | |
- os: ubuntu | |
shell: bash | |
- os: macOS | |
shell: bash | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
steps: | |
- uses: actions/checkout@v2 | |
- if: runner.os == 'Windows' | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: >- | |
autoconf | |
autoconf-archive | |
autotools | |
automake | |
gawk | |
base-devel | |
bzip2 | |
ca-certificates | |
curl | |
git | |
gzip | |
make | |
mingw-w64-x86_64-pkgconf | |
wget | |
xz | |
# this action is broken shite: https://github.com/msys2/setup-msys2/issues/104 | |
path-type: inherit | |
- if: runner.os == 'macOS' | |
name: Install automake via brew | |
run: | | |
bash .github/scripts/brew.sh automake | |
echo "$HOME/.brew/bin" >> $GITHUB_PATH | |
echo "$HOME/.brew/sbin" >> $GITHUB_PATH | |
- id: get | |
run: | | |
builder=$(echo ${{ matrix.builder }} | awk '{ print $1 }') | |
builder_version=$(echo ${{ matrix.builder }} | awk '{ print $2 }') | |
ghc_version=$(echo ${{ matrix.builder }} | awk '{ print $4 }') | |
echo "::set-output name=builder::$builder" | |
echo "::set-output name=builder_version::$builder_version" | |
echo "::set-output name=ghc_version::$ghc_version" | |
shell: bash | |
- if: matrix.os == 'windows' | |
name: Install ghcup on windows | |
run: | | |
Set-Location -Path "$env:temp" | |
curl.exe -O "https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1" | |
.\bootstrap-haskell.ps1 -Minimal -InBash -ExistingMsys2Dir C:\msys64 -InstallDir C:\ | |
shell: pwsh | |
- if: matrix.os != 'windows' | |
name: Install ghcup on Linux/macOS | |
run: curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh | |
- if: matrix.os == 'windows' | |
name: Add ghcup to PATH on windows | |
run: echo "/c/ghcup/bin" >> $GITHUB_PATH | |
- name: Install ghc/cabal | |
run: | | |
[ -n "${{ steps.get.outputs.ghc_version }}" ] && ghcup install ghc --set ${{ steps.get.outputs.ghc_version }} | |
ghcup install ${{ steps.get.outputs.builder }} ${{ steps.get.outputs.builder_version }} | |
- name: Cache | |
uses: actions/cache@v1 | |
env: | |
cache-name: ${{ steps.get.outputs.builder }} | |
with: | |
path: ~/.${{ steps.get.outputs.builder }} | |
key: ${{ matrix.os }}-${{ matrix.builder }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} | |
restore-keys: | | |
${{ matrix.os }}-${{ matrix.builder }}-build-${{ env.cache-name }}- | |
${{ matrix.os }}-${{ matrix.builder }}-build- | |
${{ matrix.os }}-${{ matrix.builder }}- | |
${{ matrix.os }}- | |
- name: Update cabal/stack index | |
run: | | |
if [ "${{ steps.get.outputs.builder }}" = "stack" ] ; then | |
mkdir -p ~/.stack | |
echo 'skip-msys: true' >> ~/.stack/config.yaml | |
echo -e 'extra-include-dirs:\n- "/c/msys64/mingw64/include"' >> ~/.stack/config.yaml | |
echo -e 'extra-lib-dirs:\n- "/c/msys64/mingw64/lib"' >> ~/.stack/config.yaml | |
echo -e 'extra-path:\n- "/c/msys64/usr/bin"\n- "/c/msys64/mingw64/bin"' >> ~/.stack/config.yaml | |
fi | |
${{ steps.get.outputs.builder }} update | |
- if: matrix.os == 'linux' && steps.get.outputs.builder == 'cabal' | |
name: Install cabal-docspec | |
run: | | |
mkdir -p "$HOME/.local/bin" | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz > cabal-docspec.xz | |
echo '0829bd034fba901cbcfe491d98ed8b28fd54f9cb5c91fa8e1ac62dc4413c9562 cabal-docspec.xz' | sha256sum -c - | |
xz -d < cabal-docspec.xz > "$HOME/.local/bin/cabal-docspec" | |
rm -f cabal-docspec.xz | |
chmod a+x "$HOME/.local/bin/cabal-docspec" | |
- if: matrix.os == 'windows' | |
name: Set cabal.project.local | |
run: | | |
echo -e 'package libarchive\n flags: -system-libarchive -no-exe' >> cabal.project.local | |
- if: matrix.os != 'windows' | |
name: Set cabal.project.local | |
run: | | |
echo -e 'package libarchive\n flags: -no-exe' >> cabal.project.local | |
- name: autoreconf | |
run: | | |
cd libarchive-clib | |
autoreconf -fi | |
- name: Build | |
run: ${{ steps.get.outputs.builder }} build libarchive | |
- name: Run tests | |
run: ${{ steps.get.outputs.builder }} test libarchive | |
- if: matrix.os == 'linux' && steps.get.outputs.builder == 'cabal' | |
name: Run doctests | |
run: cabal-docspec -XCPP -XTypeSynonymInstances -XOverloadedStrings libarchive | |
- name: Download benchmark files | |
run: make -C libarchive -j1 setup | |
- name: Run benches | |
run: ${{ steps.get.outputs.builder }} bench libarchive | |
- name: Build haddock | |
run: ${{ steps.get.outputs.builder }} haddock libarchive | |
continue-on-error: true | |
- if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: plan.json | |
path: ./dist-newstyle/cache/plan.json | |