# reasonably thorough build/test/benchmark/haddock/functest testing, # on linux, run nightly and also for noteworthy pull requests # based on https://gist.github.com/mstksg/11f753d891cee5980326a8ea8c865233 # docs: # http://www.btellez.com/posts/triggering-github-actions-with-webhooks.html # https://github.com/actions/cache # https://github.com/actions/setup-haskell # https://github.com/actions/upload-artifact # https://github.com/marketplace/actions/cache # https://github.com/marketplace/actions/checkout # https://github.com/sdras/awesome-actions # https://help.github.com/en/actions # https://help.github.com/en/actions/configuring-and-managing-workflows/caching-and-storing-workflow-data # https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows # https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources # https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm name: linux nightly/pr CI on: # XXX not supported yet; build on noteworthy push to "ci" instead # schedule: # - cron: "0 23 * * *" pull_request: branches: [ master ] paths: - '.github/workflows/linux-nightly.yml' - 'stack*' - 'hledger-lib' - 'hledger' - 'hledger-ui' - 'hledger-web' - 'tests' - '!**.md' - '!**.1' - '!**.5' - '!**.info' - '!**.txt' push: branches: [ ci, master ] # master too for testing paths: - '.github/workflows/linux-nightly.yml' - 'stack*' - 'hledger-lib' - 'hledger' - 'hledger-ui' - 'hledger-web' - 'tests' - '!**.md' - '!**.1' - '!**.5' - '!**.info' - '!**.txt' jobs: build: strategy: matrix: os: [ubuntu-latest] plan: # - { build: stack, resolver: "--resolver lts-9" } # ghc-8.0.2 # - { build: stack, resolver: "--resolver lts-11" } # ghc-8.2.2 # - { build: stack, resolver: "--resolver lts-12" } # ghc-8.4.4 ## - { build: stack, resolver: "--resolver lts-13" } redundant because lts-14 checks ghc-8.6 already # - { build: stack, resolver: "--resolver lts-14" } # ghc-8.6.5 - { build: stack, resolver: "--resolver lts-15" } # ghc-8.8.2 # - { build: stack, resolver: "--resolver nightly" } # - { build: stack, resolver: "" } # - { build: cabal, ghc: 8.0.2, cabal-install: "2.0" } # setup-haskell only supports cabal-install 2.0 and higher # - { build: cabal, ghc: 8.2.2, cabal-install: "2.0" } # - { build: cabal, ghc: 8.4.4, cabal-install: "2.2" } # - { build: cabal, ghc: 8.6.5, cabal-install: "2.4" } # - { build: cabal, ghc: 8.8.1, cabal-install: "2.4" } # currently not working for >= 3.0 # use this to include any dependencies from OS package managers # include: [] # - os: macos-latest # brew: anybrewdeps # - os: ubuntu-latest # apt-get: happy libblas-dev liblapack-dev # exclude: # - os: macos-latest # plan: # build: cabal runs-on: ${{ matrix.os }} steps: - name: Check out uses: actions/checkout@v2 # declare/restore cached things - name: Cache stack global package db id: stack-global uses: actions/cache@v1 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@v1 with: path: ~/.local/bin key: ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-programs ${{ runner.os }}-local-bin # stack's local package dbs for the project and each package - name: Cache .stack-work uses: actions/cache@v1 with: path: .stack-work key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} restore-keys: ${{ runner.os }}-stack-work - name: Cache hledger-lib/.stack-work uses: actions/cache@v1 with: path: hledger-lib/.stack-work key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }} restore-keys: ${{ runner.os }}-hledger-lib-stack-work - name: Cache hledger/.stack-work uses: actions/cache@v1 with: path: hledger/.stack-work key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }} restore-keys: ${{ runner.os }}-hledger-stack-work - name: Cache hledger-ui/.stack-work uses: actions/cache@v1 with: path: hledger-ui/.stack-work key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }} restore-keys: ${{ runner.os }}-hledger-ui-stack-work - name: Cache hledger-web/.stack-work uses: actions/cache@v1 with: path: hledger-web/.stack-work key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }} restore-keys: ${{ runner.os }}-hledger-web-stack-work # actions - name: Install stack # curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C $INSTALLDIR '*/stack' # mkdir -p ~/.local/bin # export PATH=~/.local/bin:$PATH # if [[ ! -x ~/.local/bin/stack ]]; then curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi run: | stack --version - name: Install GHC run: | stack $ARGS setup --install-ghc env: ARGS: ${{ matrix.plan.resolver }} - name: Install haskell deps run: | stack $ARGS build --test --bench --only-dependencies # --no-terminal env: ARGS: ${{ matrix.plan.resolver }} - name: Build hledger and test unit tests, doc tests run: | stack $ARGS build --pedantic --test --bench # --ghc-options=-Werror --no-terminal # --no-run-benchmarks env: ARGS: ${{ matrix.plan.resolver }} - name: Install shelltestrunner run: | export PATH=~/.local/bin:$PATH if [[ ! -x ~/.local/bin/shelltest ]]; then stack $ARGS install shelltestrunner-1.9; fi shelltest --version env: ARGS: ${{ matrix.plan.resolver }} - name: Test functional tests (excluding addons) run: | COLUMNS=80 stack $ARGS exec -- shelltest --execdir -j16 tests -x /bin -x /addons env: ARGS: ${{ matrix.plan.resolver }} - name: Test haddock generation shell: bash run: | time stack $ARGS build --fast --haddock --no-haddock-deps --no-haddock-hyperlink-source --haddock-arguments="--no-print-missing-docs" # --no-haddock-hyperlink-source is 25% faster # --no-print-missing-docs is 600% quieter env: ARGS: ${{ matrix.plan.resolver }} - name: show stuff run: | if [[ -e ~/.stack ]]; then ls -lFRa ~/.stack; fi - name: show stuff run: | if [[ -e ~/.local/bin ]]; then ls -lFRa ~/.local/bin; fi # https://github.com/mxschmitt/action-tmate # - name: Setup tmate session # uses: mxschmitt/action-tmate@v1