Skip to content

Bump pandoc and GHC #464

Bump pandoc and GHC

Bump pandoc and GHC #464

Workflow file for this run

name: Haskell CI
on: [push]
env:
PANDOC_VERSION: "3.1.13"
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ghcver: ['9.6.5']
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v2
with:
ghc-version: ${{matrix.ghcver}}
- name: Cabal init
shell: pwsh
run: |
$store = Join-Path $pwd ".cabal-store"
New-Item -ItemType Directory -Force "$store"
cabal user-config init --force --augment="store-dir: $store" `
--augment="install-method: copy"
- name: Cabal update
run: cabal v2-update
- name: Copy build config
shell: bash
run: cp misc/${{runner.os}}-build-cabal-config ./cabal.project
- name: Cabal configure
run: cabal v2-configure --constraint pandoc==${{ env.PANDOC_VERSION }} --constraint zip-archive'>='0.4.2.1 --enable-tests ${{matrix.extra-options}}
- uses: actions/cache@v2
with:
path: .cabal-store
key: r2-${{runner.os}}-${{matrix.ghcver}}-${{ env.PANDOC_VERSION }}-${{hashFiles('pandoc-crossref.cabal')}}-${{hashFiles('dist-newstyle/cache/plan.json')}}
restore-keys: |
r2-${{runner.os}}-${{matrix.ghcver}}-${{ env.PANDOC_VERSION }}-${{hashFiles('pandoc-crossref.cabal')}}-${{hashFiles('dist-newstyle/cache/plan.json')}}
r2-${{runner.os}}-${{matrix.ghcver}}-${{ env.PANDOC_VERSION }}-${{hashFiles('pandoc-crossref.cabal')}}
r2-${{runner.os}}-${{matrix.ghcver}}-${{ env.PANDOC_VERSION }}
- shell: bash
run: |
rm -rvf .cabal-store/ghc-${{matrix.ghcver}}/pandoc-crossref-* || true
rm -rvf .cabal-store/ghc-${{matrix.ghcver}}/pandoc-crossr_-* || true
rm -rvf .cabal-store/ghc-${{matrix.ghcver}}/pndc-crssrf-* || true
ls .cabal-store/ghc-${{matrix.ghcver}}/ || true
- name: Install dependencies
run: cabal v2-build --only-dependencies
- name: Build
run: cabal v2-build
- name: Run tests
run: cabal v2-test
- name: Install
shell: bash
run: |
mkdir pandoc-crossref-${{runner.os}}
export GIT_DIR="$PWD/.git"
cabal v2-install --installdir=$PWD/pandoc-crossref-${{runner.os}}
- name: Get Version
shell: bash
id: get_version
run: |
cd pandoc-crossref-${{runner.os}}/
case "${{runner.os}}" in
Windows)
VERSION="$(./pandoc-crossref.exe --version)"
;;
*) chmod +x pandoc-crossref
VERSION="$(./pandoc-crossref --version)"
;;
esac
echo "$VERSION"
echo "$VERSION" > version.txt
- uses: actions/upload-artifact@v2
with:
name: ${{runner.os}}-build
path: pandoc-crossref-${{runner.os}}
- shell: bash
run: |
rm -rvf .cabal-store/ghc-${{matrix.ghcver}}/pandoc-crossref-*
rm -rvf .cabal-store/ghc-${{matrix.ghcver}}/pandoc-crossr_-*
rm -rvf .cabal-store/ghc-${{matrix.ghcver}}/pndc-crssrf-*
build-nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
substituters = https://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
- uses: cachix/cachix-action@v12
with:
name: pandoc-crossref
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build
- run: nix build .#static
- run: |
cp -r result/bin/ pandoc-crossref-${{runner.os}}
chmod +w -R pandoc-crossref-${{runner.os}}
- name: Check pandoc version for static binary
run: |
./pandoc-crossref-${{runner.os}}/pandoc-crossref --version | grep -q 'Pandoc v${{ env.PANDOC_VERSION }}'
- run: nix run .#test
- run: nix run .#test-integrative
- run: nix develop -c echo ok
- name: Check pandoc version in shell
run: |
[ "$(nix develop -c pandoc --version | head -n1)" == "pandoc ${{ env.PANDOC_VERSION }}" ]
- name: Make manpage
run: |
nix develop -c pandoc -s -t man docs/index.md -o pandoc-crossref-${{runner.os}}/pandoc-crossref.1
- name: Get Version
shell: bash
id: get_version
run: |
cd pandoc-crossref-${{runner.os}}/
chmod +x pandoc-crossref
VERSION="$(./pandoc-crossref --version)"
echo "$VERSION"
echo "$VERSION" > version.txt
- uses: actions/upload-artifact@v2
with:
name: ${{runner.os}}-build-static
path: pandoc-crossref-${{runner.os}}
release:
needs: [build, build-nix]
runs-on: ubuntu-latest
container: alpine:3.15.0
steps:
- run: |
echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
apk add --update --no-cache p7zip hub upx bash tar xz
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: Repack assets
run: |
mkdir assets
chmod +x Linux-build-static/pandoc-crossref
upx Linux-build-static/pandoc-crossref
chmod +x macOS-build/pandoc-crossref
echo not doing upx macOS-build/pandoc-crossref
tar cJf assets/pandoc-crossref-Linux-${{github.sha}}.tar.xz -C Linux-build-static pandoc-crossref pandoc-crossref.1
tar cJf assets/pandoc-crossref-macOS-${{github.sha}}.tar.xz -C macOS-build pandoc-crossref
cd Windows-build
upx pandoc-crossref.exe
7z a ../assets/pandoc-crossref-Windows-${{github.sha}}.7z pandoc-crossref.exe
- uses: actions/upload-artifact@v2
with:
name: release-assets
path: assets
- name: Generate description.md
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
echo -n "" > description.md
for i in *-build; do
os="${i%-build}"
desc="$(cat $i/version.txt)"
echo "${os}: ${desc}" >> description.md
done
ver="${GITHUB_REF##*/v}"
echo "### Changelog" >> description.md
sed -rn '/^## *'"${ver//./\\.}"'/,/^##[^#]/ p' CHANGELOG.md | head -n-1 | tail -n+2 >> description.md
echo "description.md"
cat description.md
- name: Rename assets for release
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
for i in assets/*; do
mv "$i" "${i/-${{github.sha}}/}"
done
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
body_path: description.md
files: |
assets/*
fail_on_unmatched_files: true
- name: Extract branch name
if: "!startsWith(github.ref, 'refs/tags/v')"
shell: bash
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
id: extract_branch
- name: Generate description outputs
if: "!startsWith(github.ref, 'refs/tags/v')"
shell: bash
run: |
for i in *-build; do
os="${i%-build}"
desc="$(cat $i/version.txt)"
echo ::set-output name=${os}::${desc}
done
id: description
- name: Upload "nightly" for Linux
if: "!startsWith(github.ref, 'refs/tags/v')"
uses: WebFreak001/deploy-nightly@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/lierdakil/pandoc-crossref/releases/44009421/assets{?name,label}
release_id: 44009421
asset_path: ./assets/pandoc-crossref-Linux-${{github.sha}}.tar.xz
asset_name: pandoc-crossref-${{steps.extract_branch.outputs.branch}}-Linux-$$.tar.xz
asset_content_type: application/x-gtar
max_releases: 21
- name: Upload "nightly" for macOS
if: "!startsWith(github.ref, 'refs/tags/v')"
uses: WebFreak001/deploy-nightly@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/lierdakil/pandoc-crossref/releases/44009421/assets{?name,label}
release_id: 44009421
asset_path: ./assets/pandoc-crossref-macOS-${{github.sha}}.tar.xz
asset_name: pandoc-crossref-${{steps.extract_branch.outputs.branch}}-macOS-$$.tar.xz
asset_content_type: application/x-gtar
max_releases: 21
- name: Upload "nightly" for Windows
if: "!startsWith(github.ref, 'refs/tags/v')"
uses: WebFreak001/deploy-nightly@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/lierdakil/pandoc-crossref/releases/44009421/assets{?name,label}
release_id: 44009421
asset_path: ./assets/pandoc-crossref-Windows-${{github.sha}}.7z
asset_name: pandoc-crossref-${{steps.extract_branch.outputs.branch}}-Windows-$$.7z
asset_content_type: application/x-7z-compressed
max_releases: 21
# TODO: where to put this?
# versionDescription: |
# Linux: ${{steps.description.outputs.Linux}}
# macOS: ${{steps.description.outputs.macOS}}
# Windows: ${{steps.description.outputs.Windows}}
build-stack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
wget https://get.haskellstack.org/stable/linux-x86_64.tar.gz
tar zxf linux-x86_64.tar.gz
mv stack-*/stack ./
chmod +x ./stack
- uses: actions/cache@v1
with:
path: /home/runner/.stack
key: ${{ runner.os }}-stack
- name: Build and test
run: ./stack build --test
- name: Verify version
shell: bash
run: |
stack exec -- pandoc-crossref --version | grep -q 'Pandoc v${{ env.PANDOC_VERSION }}'