139 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			139 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| # Fairly thorough tests on mac.
 | |
| # Runs on notable pushes to ci-mac, and weekly on master.
 | |
| # Builds all modules optimised, runs unit, doc, functional tests,
 | |
| # and uploads binaries artifact.
 | |
| 
 | |
| name: mac CI
 | |
| 
 | |
| on:
 | |
|   schedule:
 | |
|   - cron: "0 07 * * 0"  # sunday midnight pacific
 | |
| 
 | |
|   push:
 | |
|     branches: [ ci-mac ]
 | |
|     paths:
 | |
|       - '.github/workflows/mac.yml'
 | |
|       - 'stack*.yaml'
 | |
|       - 'hledger-lib/**'
 | |
|       - 'hledger/**'
 | |
|       - 'hledger-ui/**'
 | |
|       - 'hledger-web/**'
 | |
|       - 'tests/**'
 | |
|       - '!**.md'
 | |
|       - '!**.1'
 | |
|       - '!**.5'
 | |
|       - '!**.info'
 | |
|       - '!**.txt'
 | |
| 
 | |
| jobs:
 | |
|   build:
 | |
|     runs-on: macos-latest
 | |
|     steps:
 | |
| 
 | |
|     - name: Check out
 | |
|       uses: actions/checkout@v2
 | |
| 
 | |
|     # things to be cached/restored:
 | |
| 
 | |
|     - name: Cache stack global package db
 | |
|       id:   stack-global
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: ~/.stack
 | |
|         key:          ${{ runner.os }}-stack-global-${{ hashFiles('**.yaml') }}
 | |
|         restore-keys: |
 | |
|           ${{ runner.os }}-stack-global
 | |
|           ${{ runner.os }}-stack          
 | |
| 
 | |
|     - name: Cache stack-installed programs in ~/.local/bin
 | |
|       id:   stack-programs
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: ~/.local/bin
 | |
|         key:          ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }}
 | |
|         restore-keys: |
 | |
|           ${{ runner.os }}-stack-programs
 | |
|           ${{ runner.os }}-local-bin          
 | |
| 
 | |
|     - name: Cache .stack-work
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: .stack-work
 | |
|         key: ${{ runner.os }}-stack-work
 | |
| 
 | |
|     - name: Cache hledger-lib/.stack-work
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: hledger-lib/.stack-work
 | |
|         key: ${{ runner.os }}-hledger-lib-stack-work
 | |
| 
 | |
|     - name: Cache hledger/.stack-work
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: hledger/.stack-work
 | |
|         key: ${{ runner.os }}-hledger-stack-work
 | |
| 
 | |
|     - name: Cache hledger-ui/.stack-work
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: hledger-ui/.stack-work
 | |
|         key: ${{ runner.os }}-hledger-ui-stack-work
 | |
| 
 | |
|     - name: Cache hledger-web/.stack-work
 | |
|       uses: actions/cache@v2
 | |
|       with:
 | |
|         path: hledger-web/.stack-work
 | |
|         key: ${{ runner.os }}-hledger-web-stack-work
 | |
| 
 | |
|     # actions:
 | |
| 
 | |
|     - name: Install stack
 | |
|       # curl --insecure -L https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C $INSTALLDIR
 | |
|       run: |
 | |
|         brew install haskell-stack
 | |
|         stack --version        
 | |
| 
 | |
|     - name: Install GHC
 | |
|       run: |
 | |
|         stack setup --install-ghc        
 | |
| 
 | |
|     - name: Install haskell deps
 | |
|       run: |
 | |
|         stack build --test --only-dependencies        
 | |
| 
 | |
|     - name: Build hledger and test unit tests, doc tests
 | |
|       run: |
 | |
|         stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror        
 | |
|       # --ghc-options=-split-sections doesn't work on mac
 | |
|       #  --pedantic
 | |
| 
 | |
|     - name: Install shelltestrunner
 | |
|       run: |
 | |
|         export PATH=~/.local/bin:$PATH
 | |
|         if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.9; fi
 | |
|         shelltest --version        
 | |
| 
 | |
|     - name: Test functional tests (excluding addons)
 | |
|       run: |
 | |
|         export PATH=~/.local/bin:$PATH
 | |
|         COLUMNS=80 stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons        
 | |
| 
 | |
|     # artifacts:
 | |
| 
 | |
|     - name: Gather executables
 | |
|       run: |
 | |
|         mkdir tmp
 | |
|         cd tmp
 | |
|         mkdir hledger
 | |
|         cd hledger
 | |
|         cp ~/.local/bin/hledger .
 | |
|         cp ~/.local/bin/hledger-ui .
 | |
|         cp ~/.local/bin/hledger-web .        
 | |
| 
 | |
|     # XXX intermittent upload failures
 | |
|     - name: Upload executables artifact
 | |
|       uses: actions/upload-artifact@v2
 | |
|       with:
 | |
|         name: hledger-macos
 | |
|         path: tmp/hledger
 |