Skip to content

Merge pull request #1086 from grddavies/slice-by-1 #784

Merge pull request #1086 from grddavies/slice-by-1

Merge pull request #1086 from grddavies/slice-by-1 #784

name: build-listener-linux
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ghc: ['9.0.1']
cabal: ['3.4.0.0']
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup Haskell
uses: haskell/actions/setup@v1
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Freeze
run: cabal freeze
- name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v2
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('tidal-listener/src') }}
- name: cabal update and build
run: |
cabal update
cabal build --enable-tests tidal-listener
cabal build
- name: move GHC libs and configs
run: |
mkdir -p tidal-listener/binary/haskell-libs/ghc-packages/
cp -r ${{ steps.setup-haskell-cabal.outputs.ghc-path }}/../lib/ghc-${{ matrix.ghc }}/* tidal-listener/binary/haskell-libs/ghc-packages
- name: move installed packages
run: |
mkdir -p tidal-listener/binary/haskell-libs/packages/
cp -r ${{ steps.setup-haskell-cabal.outputs.cabal-store }}/ghc-${{ matrix.ghc }}/* tidal-listener/binary/haskell-libs/packages
ls tidal-listener/binary/haskell-libs/packages
- name: change paths in config files (GHC)
run: |
mv tidal-listener/binary/haskell-libs/ghc-packages/package.conf.d tidal-listener/binary/haskell-libs/package.conf.d
sed -i 's/\/opt\/ghc\/${{ matrix.ghc }}\/lib\/ghc-${{ matrix.ghc }}/${pkgroot}\/ghc-packages/g' tidal-listener/binary/haskell-libs/package.conf.d/*
- name: change paths in config files (cabal)
run: |
mv tidal-listener/binary/haskell-libs/packages/package.db tidal-listener/binary/haskell-libs/package.db
sed -i 's/\/home\/runner\/.cabal\/store\/ghc-${{ matrix.ghc }}/${pkgroot}\/packages/g' tidal-listener/binary/haskell-libs/package.db/*
- name: move ghc settings etc
run: |
mv tidal-listener/binary/haskell-libs/ghc-packages/settings tidal-listener/binary/haskell-libs/settings
mv tidal-listener/binary/haskell-libs/ghc-packages/platformConstants tidal-listener/binary/haskell-libs/platformConstants
mv tidal-listener/binary/haskell-libs/ghc-packages/llvm-targets tidal-listener/binary/haskell-libs/llvm-targets
mv tidal-listener/binary/haskell-libs/ghc-packages/llvm-passes tidal-listener/binary/haskell-libs/llvm-passes
- name: ghc-pkg recache
run: |
ghc-pkg --package-db=tidal-listener/binary/haskell-libs/package.conf.d recache
ghc-pkg --package-db=tidal-listener/binary/haskell-libs/package.db recache
ghc-pkg --package-db=tidal-listener/binary/haskell-libs/package.conf.d --package-db=tidal-listener/binary/haskell-libs/package.db check
- name: move c-libs
run: |
mkdir -p tidal-listener/binary/c-libs/
cp /usr/lib/x86_64-linux-gnu/libz.so.1 tidal-listener/binary/c-libs/libz.so.1
cp /usr/lib/x86_64-linux-gnu/libtinfo.so.6 tidal-listener/binary/c-libs/libtinfo.so.6
cp /usr/lib/x86_64-linux-gnu/librt.so.1 tidal-listener/binary/c-libs/librt.so.1
cp /usr/lib/x86_64-linux-gnu/libutil.so.1 tidal-listener/binary/c-libs/libutil.so.1
cp /usr/lib/x86_64-linux-gnu/libpthread.so.0 tidal-listener/binary/c-libs/libpthread.so.0
cp /usr/lib/x86_64-linux-gnu/libm.so.6 tidal-listener/binary/c-libs/libm.so.6
cp /usr/lib/x86_64-linux-gnu/libgmp.so.10 tidal-listener/binary/c-libs/libgmp.so.10
cp /usr/lib/x86_64-linux-gnu/libc.so.6 tidal-listener/binary/c-libs/libc.so.6
cp /usr/lib/x86_64-linux-gnu/libdl.so.2 tidal-listener/binary/c-libs/libdl.so.2
ln -s /usr/lib/x86_64-linux-gnu/libz.so.1 tidal-listener/binary/c-libs/libz.so
ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6 tidal-listener/binary/c-libs/libtinfo.so
ln -s /usr/lib/x86_64-linux-gnu/librt.so.1 tidal-listener/binary/c-libs/librt.so
ln -s /usr/lib/x86_64-linux-gnu/libutil.so.1 tidal-listener/binary/c-libs/libutil.so
ln -s /usr/lib/x86_64-linux-gnu/libpthread.so.0 tidal-listener/binary/c-libs/libpthread.so
ln -s /usr/lib/x86_64-linux-gnu/libm.so.6 tidal-listener/binary/c-libs/libm.so
ln -s /usr/lib/x86_64-linux-gnu/libgmp.so.10 tidal-listener/binary/c-libs/libgmp.so
ln -s /usr/lib/x86_64-linux-gnu/libc.so.6 tidal-listener/binary/c-libs/libc.so
ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 tidal-listener/binary/c-libs/libdl.so
- name: remove unneccessary libs
run: |
cd tidal-listener/binary/haskell-libs/ghc-packages
rm -r ghc-${{ matrix.ghc }}
rm -r Cabal-*
- name: fake gcc
run: |
mkdir -p tidal-listener/binary/haskell-libs/bin/
cp tidal-listener/fake_gcc.sh tidal-listener/binary/haskell-libs/bin/fake_gcc.sh
sed -i 's/cc/bin\/fake_gcc.sh/g' tidal-listener/binary/haskell-libs/settings
chmod 755 tidal-listener/binary/haskell-libs/bin/fake_gcc.sh
- name: move executable
run: |
cp dist-newstyle/build/x86_64-linux/ghc-${{ matrix.ghc }}/tidal-listener-0.1.0.0/x/tidal-listener/build/tidal-listener/tidal-listener tidal-listener/binary/tidal-listener
# cp dist-newstyle/build/x86_64-linux/ghc-${{ matrix.ghc }}/tidal-*/x/tidal/build/tidal/tidal tidal-listener/binary/tidal
- name: zip files
run: |
cd tidal-listener/
mv binary tidal
tar cvfj linux.tar tidal/*
- uses: actions/upload-artifact@v2
with:
path: tidal-listener/linux.tar
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
- run: ls */*
- uses: softprops/action-gh-release@v1
with:
files: artifact/linux.tar