Merge pull request #239 from IntersectMBO/angerman-patch-1 #1108
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 using stack for Linux | |
on: | |
pull_request: | |
branches: [ "master" ] | |
push: | |
branches: [ "master" ] | |
tags: [ "*.*.*" ] | |
permissions: | |
pages: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: 'GitHub actions env workaround' | |
run: 'echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV' | |
- name: π½ Install OS Packages | |
uses: mstksg/get-package@2a4b48d55d72d43ca89ae58ec9ca1397d34a1c35 | |
with: | |
apt-get: libgmp-dev libssl-dev | |
- name: π₯ Checkout repository | |
uses: actions/[email protected] | |
- name: π Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7.1 | |
- name: π§° Setup Stack | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: '8.10.7' | |
enable-stack: true | |
stack-version: '2.7.3' | |
- name: πΎ Cache Dependencies | |
id: cache | |
uses: actions/cache@v1 | |
with: | |
path: ~/.stack | |
key: ${{ matrix.os }}-${{ hashFiles('stack.yaml') }} | |
- name: πΈ Build Snapshot | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
stack --no-terminal test --bench --only-snapshot | |
- name: π¨ Build & Test | |
run: | | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
stack --no-terminal test --bench --haddock --no-haddock-deps --no-run-benchmarks --flag cardano-addresses:release --flag cardano-addresses-cli:release | |
mkdir -p bin && cp $(stack path --local-install-root)/bin/* bin && chmod +x bin/* | |
mkdir -p dist/haddock && mv $(stack path --local-install-root)/doc/* dist/haddock | |
sed -i 's@href="[^"]*/doc/\([^"]*.html\)"@href="\1"@g' dist/haddock/index.html | |
wget -O Makefile https://raw.githubusercontent.com/input-output-hk/adrestia/master/templates/haskell/coverage/Makefile | |
mkdir -p .coverage && touch .coverage/template.overlay | |
DESTDIR=dist/coverage make report && DESTDIR=dist/coverage make badge | |
echo "Checking for updated cabal files" | |
git diff --exit-code -- '**/*.cabal' && echo OK | |
- name: π§ͺ Test CLI examples | |
run: | | |
cd test/e2e | |
bundle install | |
rspec . | |
cd - | |
- name: π Upload Artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.os }}-exe | |
path: bin | |
- name: π€ Publish Documentation | |
if: github.event_name == 'push' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: dist | |
enable_jekyll: true | |
keep_files: true | |
release: | |
needs: [build] | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
steps: | |
- name: π₯ Checkout repository | |
uses: actions/checkout@v1 | |
- name: π·οΈ Variables | |
id: variables | |
run: | | |
echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//} | |
echo ::set-output name=pkg_name::$(cat core/*.cabal | grep "name:" | sed "s/name:\s*\(.*\)/\1/") | |
- name: π§ Download Artifact (linux) | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/download-artifact@v1 | |
with: | |
name: ubuntu-latest-exe | |
- name: π¦ Package Artifacts | |
run: | | |
mv ubuntu-latest-exe bin | |
tar czf $PKG_NAME-$TAG-linux64.tar.gz README.md LICENSE NOTICE bin/* | |
rm -rf bin | |
env: | |
PKG_NAME: ${{ steps.variables.outputs.pkg_name }} | |
TAG: ${{ steps.variables.outputs.tag }} | |
- name: π Release | |
uses: docker://antonyurchenko/git-release:latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DRAFT_RELEASE: "true" | |
PRE_RELEASE: "false" | |
CHANGELOG_FILE: "ChangeLog.md" | |
ALLOW_EMPTY_CHANGELOG: "false" | |
with: | |
args: | | |
${{ steps.variables.outputs.pkg_name }}-${{ steps.variables.outputs.tag }}-linux64.tar.gz |