Version 0.1.3.0 #61
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: CI | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
release: | |
types: | |
- prereleased | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: | |
- ubuntu-latest | |
ghc_version: | |
- "8.6.5" | |
- "8.8.4" | |
- "8.10.7" | |
- "9.0.2" | |
- "9.2.8" | |
- "9.4.8" | |
- "9.6.3" | |
- "9.8.1" | |
fail-fast: false | |
name: Build on Linux, GHC ${{ matrix.ghc_version }} | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc_version }} | |
cabal-version: "3.10.1.0" | |
- name: Install C++ library | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libphonenumber-dev | |
- name: cabal sdist | |
run: cabal sdist --output-dir "$GITHUB_WORKSPACE/sdist" | |
- name: unpack | |
run: | | |
mkdir -p "$GITHUB_WORKSPACE/unpacked" | |
find "$GITHUB_WORKSPACE/sdist" -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C "$GITHUB_WORKSPACE/unpacked" -xzvf {} \; | |
echo "PKGDIR_libphonenumber=$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/libphonenumber-[0-9.]*')" >> "$GITHUB_ENV" | |
- name: cabal configure | |
run: cd "$PKGDIR_libphonenumber" && cabal configure --with-ghc=ghc-${{ matrix.ghc_version }} | |
- name: Install dependencies | |
run: cd "$PKGDIR_libphonenumber" && cabal build --dependencies-only --enable-tests --haddock-all | |
- name: cabal build | |
run: cd "$PKGDIR_libphonenumber" && cabal build --ghc-options=-Werror | |
- name: cabal test spec_test | |
run: cd "$PKGDIR_libphonenumber" && cabal test spec_test | |
- name: cabal check | |
run: cd "$PKGDIR_libphonenumber" && cabal check | |
- name: cabal haddock | |
run: cd "$PKGDIR_libphonenumber" && cabal haddock | |
dist: | |
needs: build | |
runs-on: ubuntu-latest | |
name: Build source tarball | |
if: github.event_name == 'release' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: haskell/actions/setup@v2 | |
with: | |
cabal-version: "3.10.1.0" | |
- name: Install C++ library | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libphonenumber-dev | |
- name: cabal sdist | |
run: | | |
cabal sdist --output-dir "$GITHUB_WORKSPACE/sdist" | |
echo "dist=$(find "$GITHUB_WORKSPACE/sdist" -maxdepth 1 -type f -name '*.tar.gz')" >> "$GITHUB_ENV" | |
- name: cabal haddock | |
run: | | |
cabal haddock --builddir "$GITHUB_WORKSPACE/doc" --haddock-for-hackage --enable-doc | |
echo "docs=$(find "$GITHUB_WORKSPACE/doc" -maxdepth 1 -type f -name '*-docs.tar.gz')" >> "$GITHUB_ENV" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: Source tarball | |
path: ${{ env.dist }} | |
- uses: svenstaro/upload-release-action@2.2.1 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.dist }} | |
tag: ${{ github.ref }} | |
- name: Upload tarball to hackage | |
run: | | |
curl -X POST 'https://hackage.haskell.org/packages/candidates/' -H "Authorization: X-ApiKey ${{ secrets.HACKAGE_KEY }}" -F "package=@$dist" -w '%{url_effective}\n' | |
- name: Upload haddocks to hackage | |
run: | | |
curl -X PUT "https://hackage.haskell.org/package/$(basename ${docs%-docs.tar.gz})/candidate/docs" -H "Authorization: X-ApiKey ${{ secrets.HACKAGE_KEY }}" -H 'Content-type: application/x-tar' -H 'Content-encoding: gzip' --data-binary "@$docs" |