72 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| # Runs on any push to ci-linux-x64.
 | |
| # Produces optimised static x64 linux  binaries,
 | |
| # using the GHC version below (9.2.3) and cabal.
 | |
| # Currently runs no tests.
 | |
| # XXX This is randomly segfaulting while building packages, needs replacing.
 | |
| 
 | |
| name: binaries-linux-x64-static
 | |
| 
 | |
| on:
 | |
|   push:
 | |
|     branches: [ ci-linux-x64, binaries ]
 | |
|     #tags:
 | |
|     #  - '[0-9]+.[0-9]+'
 | |
|     #  - '[0-9]+.[0-9]+-*'
 | |
|     #  - '[0-9]+.[0-9]+.[0-9]+'
 | |
|     #  - '[0-9]+.[0-9]+.[0-9]+-*'
 | |
|   workflow_dispatch:
 | |
| 
 | |
| jobs:
 | |
|   build:
 | |
|     runs-on: ubuntu-latest
 | |
|     container: alpine:edge
 | |
|     steps:
 | |
| 
 | |
|     - name: Setup environment
 | |
|       # Borrowed from fossas/haskell-static-alpine, copied here for transparency
 | |
|       run: |
 | |
|         apk --no-cache add binutils-gold curl gcc g++ git gmp-dev ncurses-dev ncurses-static libffi-dev make xz tar perl zlib-dev zlib-static
 | |
|         mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup
 | |
|         ~/.ghcup/bin/ghcup install ghc 9.2.3 && ~/.ghcup/bin/ghcup set ghc 9.2.3 && ~/.ghcup/bin/ghcup install cabal
 | |
|         echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH        
 | |
| 
 | |
|     - name: Check out
 | |
|       uses: actions/checkout@v2
 | |
|       # have to fetch everything for git describe for --version
 | |
|       with: 
 | |
|         fetch-depth: 0  
 | |
| 
 | |
|     - name: Cache cabal packages, binaries
 | |
|       id:   cabal
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: ~/.cabal
 | |
|         key: ${{ runner.os }}-cabal-20220711-${{ hashFiles('**.yaml') }}
 | |
|         restore-keys: |
 | |
|              ${{ runner.os }}-cabal-20220711             
 | |
| 
 | |
|     - name: Update cabal
 | |
|       run: cabal update
 | |
| 
 | |
|     - name: Build on alpine
 | |
|       run: |
 | |
|         cabal build --enable-executable-static hledger || echo "ERROR: building hledger failed"
 | |
|         cabal build --enable-executable-static hledger-ui || echo "ERROR: building hledger failed"
 | |
|         cabal build --enable-executable-static hledger-web || echo "ERROR: building hledger-web failed"        
 | |
| 
 | |
|     - name: Extract and strip binaries
 | |
|       run: |
 | |
|         mkdir /tmp/hledger
 | |
|         cp dist-newstyle/build/x86_64-linux/ghc-*/hledger-*/x/hledger/build/hledger/hledger /tmp/hledger/hledger
 | |
|         cp dist-newstyle/build/x86_64-linux/ghc-*/hledger-ui-*/x/hledger-ui/build/hledger-ui/hledger-ui /tmp/hledger/hledger-ui
 | |
|         cp dist-newstyle/build/x86_64-linux/ghc-*/hledger-web-*/x/hledger-web/build/hledger-web/hledger-web /tmp/hledger/hledger-web
 | |
|         strip /tmp/hledger/hledger
 | |
|         strip /tmp/hledger/hledger-ui
 | |
|         strip /tmp/hledger/hledger-web        
 | |
| 
 | |
|     - name: Upload binaries
 | |
|       uses: actions/upload-artifact@v2
 | |
|       with:
 | |
|         name: hledger-linux-x64
 | |
|         path: /tmp/hledger
 |