From 32a105bac85e16a4126491206dcac4ef67fbac31 Mon Sep 17 00:00:00 2001 From: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> Date: Fri, 21 Jan 2022 00:19:39 +0400 Subject: [PATCH] fix Windows CI to fail when commands fail, use fixed terminal package (#214) * fix windows CI * use fixed terminal package Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- .github/workflows/build.yml | 55 ++++++++++++++++++++++++++----------- cabal.project | 2 +- stack.yaml | 2 +- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ab917a6d..6590ac2b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: push: branches: - master - - v4 + - stable tags: - "v*" pull_request: @@ -49,24 +49,15 @@ jobs: include: - os: ubuntu-20.04 cache_path: ~/.stack - stack_args: "--test" - artifact_rel_path: /bin/simplex-chat asset_name: simplex-chat-ubuntu-20_04-x86-64 - os: ubuntu-18.04 cache_path: ~/.stack - stack_args: "--test" - artifact_rel_path: /bin/simplex-chat asset_name: simplex-chat-ubuntu-18_04-x86-64 - os: macos-latest cache_path: ~/.stack - stack_args: "--test" - artifact_rel_path: /bin/simplex-chat asset_name: simplex-chat-macos-x86-64 - # TODO enable tests for windows once fixed (remove stack_args altogether) - os: windows-latest cache_path: C:/sr - stack_args: "" - artifact_rel_path: /bin/simplex-chat.exe asset_name: simplex-chat-windows-x86-64 steps: - name: Clone project @@ -85,17 +76,49 @@ jobs: path: ${{ matrix.cache_path }} key: ${{ matrix.os }}-${{ hashFiles('stack.yaml') }} - - name: Build & test - id: build_test + # / Unix + + - name: Unix build + id: unix_build + if: matrix.os != 'windows-latest' + shell: bash run: | - stack build ${{ matrix.stack_args }} + stack build --test echo "::set-output name=LOCAL_INSTALL_ROOT::$(stack path --local-install-root)" - - name: Upload binaries to release - if: startsWith(github.ref, 'refs/tags/v') + - name: Unix upload binary to release + if: startsWith(github.ref, 'refs/tags/v') && matrix.os != 'windows-latest' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ steps.build_test.outputs.LOCAL_INSTALL_ROOT }}${{ matrix.artifact_rel_path }} + file: ${{ steps.unix_build.outputs.LOCAL_INSTALL_ROOT }}/bin/simplex-chat asset_name: ${{ matrix.asset_name }} tag: ${{ github.ref }} + + # Unix / + + # / Windows + + # * In powershell multiline commands do not fail if individual commands fail - https://github.community/t/multiline-commands-on-windows-do-not-fail-if-individual-commands-fail/16753 + # * And GitHub Actions does not support parameterizing shell in a matrix job - https://github.community/t/using-matrix-to-specify-shell-is-it-possible/17065 + # * So we're running a separate set of actions for Windows build + + # TODO run tests on Windows + - name: Windows build + id: windows_build + if: matrix.os == 'windows-latest' + shell: cmd + run: | + stack build + echo "::set-output name=LOCAL_INSTALL_ROOT::$(stack path --local-install-root)" + + - name: Windows upload binary to release + if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'windows-latest' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.windows_build.outputs.LOCAL_INSTALL_ROOT }}/bin/simplex-chat.exe + asset_name: ${{ matrix.asset_name }} + tag: ${{ github.ref }} + + # Windows / diff --git a/cabal.project b/cabal.project index 842206375..2ba37ee93 100644 --- a/cabal.project +++ b/cabal.project @@ -9,4 +9,4 @@ source-repository-package source-repository-package type: git location: git://github.com/simplex-chat/haskell-terminal.git - tag: 5e0759ce4f9655fd3f0d94c76225e6904630dfd3 + tag: f708b00009b54890172068f168bf98508ffcd495 diff --git a/stack.yaml b/stack.yaml index d17f2317d..e7e09510e 100644 --- a/stack.yaml +++ b/stack.yaml @@ -39,7 +39,7 @@ extra-deps: - simple-logger-0.1.0@sha256:be8ede4bd251a9cac776533bae7fb643369ebd826eb948a9a18df1a8dd252ff8,1079 # - terminal-0.2.0.0@sha256:de6770ecaae3197c66ac1f0db5a80cf5a5b1d3b64a66a05b50f442de5ad39570,2977 - github: simplex-chat/haskell-terminal - commit: 5e0759ce4f9655fd3f0d94c76225e6904630dfd3 + commit: f708b00009b54890172068f168bf98508ffcd495 - simplexmq-1.0.0@sha256:34b2004728ae396e3ae449cd090ba7410781e2b3cefc59259915f4ca5daa9ea8,8561 # - ../simplexmq # - github: simplex-chat/simplexmq