diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b035b87c4..40cdf924c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,5 @@ -# general multi-platform CI tests for hledger +# general multi-platform CI tests +# build/test/benchmark/haddock on all platforms; disabled in favour of platform-specific workflows # based on https://gist.github.com/mstksg/11f753d891cee5980326a8ea8c865233 # docs: @@ -16,37 +17,37 @@ # https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm -name: hledger CI +name: multiplatform CI on: - push: - branches: [ master ] - paths: - - 'stack*' - - 'hledger-lib' - - 'hledger' - - 'hledger-ui' - - 'hledger-web' - - '.github/workflows/*' - - '!**.md' - - '!**.1' - - '!**.5' - - '!**.info' - - '!**.txt' - pull_request: - branches: [ master ] - paths: - - 'stack*' - - 'hledger-lib' - - 'hledger' - - 'hledger-ui' - - 'hledger-web' - - '.github/workflows/*' - - '!**.md' - - '!**.1' - - '!**.5' - - '!**.info' - - '!**.txt' + # push: + # branches: [ master ] + # paths: + # - 'stack*' + # - 'hledger-lib' + # - 'hledger' + # - 'hledger-ui' + # - 'hledger-web' + # - '.github/workflows/*' + # - '!**.md' + # - '!**.1' + # - '!**.5' + # - '!**.info' + # - '!**.txt' + # pull_request: + # branches: [ master ] + # paths: + # - 'stack*' + # - 'hledger-lib' + # - 'hledger' + # - 'hledger-ui' + # - 'hledger-web' + # - '.github/workflows/*' + # - '!**.md' + # - '!**.1' + # - '!**.5' + # - '!**.info' + # - '!**.txt' # schedule: # - cron: "0 23 * * *" @@ -156,6 +157,10 @@ jobs: 7z x stack.zip -oC:\Windows stack.exe stack --version + - name: Install GHC + run: | + stack setup $ARGS + - name: Install haskell deps run: | stack --install-ghc $ARGS test --bench --only-dependencies diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml new file mode 100644 index 000000000..c35e2f5a3 --- /dev/null +++ b/.github/workflows/linux-ci.yml @@ -0,0 +1,176 @@ +# linux CI tests +# reasonably thorough build/test/benchmark/haddock/functest testing +# with stackage lts, run on master push/pull request + +# 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 CI + +on: + # schedule: + # - cron: "0 23 * * *" + push: + branches: [ master ] + paths: + - 'stack*' + - 'hledger-lib' + - 'hledger' + - 'hledger-ui' + - 'hledger-web' + - '.github/workflows/*' + - '!**.md' + - '!**.1' + - '!**.5' + - '!**.info' + - '!**.txt' + pull_request: + branches: [ master ] + paths: + - 'stack*' + - 'hledger-lib' + - 'hledger' + - 'hledger-ui' + - 'hledger-web' + - '.github/workflows/*' + - '!**.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: + + # cached things + + - name: Cache ~/.stack + uses: actions/cache@v1 + with: + path: ~/.stack + key: ${{ runner.os }}-stack + #key: ${{ runner.os }}-${{ matrix.resolver }}-stack + + - name: Cache ~/.local/bin + uses: actions/cache@v1 + with: + path: ~/.local/bin + key: ${{ runner.os }}-local-bin + + - name: Cache .stack-work + uses: actions/cache@v1 + with: + path: .stack-work + key: ${{ 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 + + - name: Cache hledger/.stack-work + uses: actions/cache@v1 + with: + path: hledger/.stack-work + key: ${{ 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 + + - name: Cache hledger-web/.stack-work + uses: actions/cache@v1 + with: + path: hledger-web/.stack-work + key: ${{ runner.os }}-hledger-web-stack-work + + # actions + + - name: Check out + uses: actions/checkout@v2 + + - 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 + env: + ARGS: ${{ matrix.plan.resolver }} + + - name: Install shelltestrunner + run: | + if [[ ! -x ~/.local/bin/shelltest ]]; then stack $ARGS install shelltestrunner-1.9; fi + shelltest --version + env: + ARGS: ${{ matrix.plan.resolver }} + + - name: Install haskell deps + run: | + stack $ARGS test --bench --only-dependencies + # --no-terminal + env: + ARGS: ${{ matrix.plan.resolver }} + + - name: Build/unittest/benchmark/haddock hledger + run: | + stack $ARGS build --ghc-options=-Werror --test --bench --haddock --no-haddock-deps + # --no-terminal # --no-run-benchmarks + env: + ARGS: ${{ matrix.plan.resolver }} + + - name: Functional tests (excluding addons) + run: | + COLUMNS=80 stack $ARGS exec -- shelltest --execdir -j16 tests -x /bin -x /addons + env: + ARGS: ${{ matrix.plan.resolver }} diff --git a/.github/workflows/mac-ci.yml b/.github/workflows/mac-ci.yml new file mode 100644 index 000000000..ce627e515 --- /dev/null +++ b/.github/workflows/mac-ci.yml @@ -0,0 +1,118 @@ +# mac CI tests +# basic build testing, run nightly + +name: mac CI + +on: + schedule: + - cron: "0 23 * * *" + # uncomment when testing CI: + push: + branches: [ master ] + paths: + - 'stack*' + - 'hledger-lib' + - 'hledger' + - 'hledger-ui' + - 'hledger-web' + - '.github/workflows/*' + - '!**.md' + - '!**.1' + - '!**.5' + - '!**.info' + - '!**.txt' + # pull_request: + # branches: [ master ] + # paths: + # - 'stack*' + # - 'hledger-lib' + # - 'hledger' + # - 'hledger-ui' + # - 'hledger-web' + # - '.github/workflows/*' + # - '!**.md' + # - '!**.1' + # - '!**.5' + # - '!**.info' + # - '!**.txt' + +jobs: + build: + runs-on: macos-latest + steps: + + # cached things + + - name: Cache ~/.stack + uses: actions/cache@v1 + with: + path: ~/.stack + key: ${{ runner.os }}-stack + + - name: Cache ~/.local/bin + uses: actions/cache@v1 + with: + path: ~/.local/bin + key: ${{ runner.os }}-local-bin + + - name: Cache .stack-work + uses: actions/cache@v1 + with: + path: .stack-work + key: ${{ 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 + + - name: Cache hledger/.stack-work + uses: actions/cache@v1 + with: + path: hledger/.stack-work + key: ${{ 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 + + - name: Cache hledger-web/.stack-work + uses: actions/cache@v1 + with: + path: hledger-web/.stack-work + key: ${{ runner.os }}-hledger-web-stack-work + + # actions + + - name: Check out + uses: actions/checkout@v2 + + - 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 --resolver=lts setup + + # - name: Install shelltestrunner + # - if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.9; fi + # - shelltest --version + + - name: Install haskell deps + run: | + stack --resolver=lts --install-ghc test --bench --only-dependencies + # --no-terminal --bench --install-ghc + + - name: Build hledger + run: | + stack --resolver=lts test --only-dependencies + # --no-terminal --bench --install-ghc + + # run hledger-lib/hledger functional tests, skipping the ones for addons + #- COLUMNS=80 stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml new file mode 100644 index 000000000..bdd7b2632 --- /dev/null +++ b/.github/workflows/windows-ci.yml @@ -0,0 +1,147 @@ +# windows CI tests +# basic hledger/hledger-web build testing, and binary building, run nightly + +name: windows CI + +on: + schedule: + - cron: "0 23 * * *" + # uncomment when testing CI: + push: + branches: [ master ] + paths: + - 'stack*' + - 'hledger-lib' + - 'hledger' + - 'hledger-ui' + - 'hledger-web' + - '.github/workflows/*' + - '!**.md' + - '!**.1' + - '!**.5' + - '!**.info' + - '!**.txt' + # pull_request: + # branches: [ master ] + # paths: + # - 'stack*' + # - 'hledger-lib' + # - 'hledger' + # - 'hledger-ui' + # - 'hledger-web' + # - '.github/workflows/*' + # - '!**.md' + # - '!**.1' + # - '!**.5' + # - '!**.info' + # - '!**.txt' + +jobs: + build: + runs-on: windows-latest + steps: + + # cached things + + - name: Cache ~/.stack + uses: actions/cache@v1 + with: + path: ~/.stack + key: ${{ runner.os }}-stack + + - name: Cache %APPDATA%/.stack + uses: actions/cache@v1 + with: + path: %APPDATA%/.stack + key: ${{ runner.os }}-stack + + - name: Cache $APPDATA/.stack + uses: actions/cache@v1 + with: + path: $APPDATA/.stack + key: ${{ runner.os }}-stack + + - name: Cache %APPDATA%/local/bin + uses: actions/cache@v1 + with: + path: %APPDATA%/local/bin + key: ${{ runner.os }}-local-bin + + - name: Cache $APPDATA/local/bin + uses: actions/cache@v1 + with: + path: $APPDATA/local/bin + key: ${{ runner.os }}-local-bin + + - name: Cache .stack-work + uses: actions/cache@v1 + with: + path: .stack-work + key: ${{ 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 + + - name: Cache hledger/.stack-work + uses: actions/cache@v1 + with: + path: hledger/.stack-work + key: ${{ 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 + + - name: Cache hledger-web/.stack-work + uses: actions/cache@v1 + with: + path: hledger-web/.stack-work + key: ${{ runner.os }}-hledger-web-stack-work + + # actions + + - name: Check out + uses: actions/checkout@v2 + + - name: Install stack + run: | + curl -skL -o stack.zip http://www.stackage.org/stack/windows-x86_64 + 7z x stack.zip -oC:\Windows stack.exe + stack --version + + - name: Install GHC + run: | + stack --resolver=lts setup + + # - name: Install shelltestrunner + # - if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.9; fi + # - shelltest --version + + - name: Install haskell deps + run: | + stack --resolver=lts test --only-dependencies + # --no-terminal --bench --install-ghc + + - name: Build hledger + run: | + stack --resolver=lts install --ghc-options=-Werror --test + # --no-terminal --bench --no-run-benchmarks --haddock --no-haddock-deps + + # run hledger-lib/hledger functional tests, skipping the ones for addons + #- COLUMNS=80 stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons + + # - name: Zip exes + # run: | + # #cd `stack path --local-bin` + # 7z a hledger.zip %HOME%/.local/bin/hledger %HOME%/.local/bin/hledger-web + + # - name: Upload zip file + # uses: actions/upload-artifact@v1 + # with: + # name: hledger.zip + # path: hledger.zip