Skip to content

Merge pull request #238 from Renegatto/alexey/fix-237 #1102

Merge pull request #238 from Renegatto/alexey/fix-237

Merge pull request #238 from Renegatto/alexey/fix-237 #1102

Workflow file for this run

name: Haskell CI using stack for Linux
on:
pull_request:
branches: [ "master" ]
push:
branches: [ "master" ]
tags: [ "*.*.*" ]
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