name: build on: push: branches: - master - stable - users tags: - "v*" pull_request: jobs: prepare-release: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - name: Clone project uses: actions/checkout@v3 - name: Build changelog id: build_changelog uses: mikepenz/release-changelog-builder-action@v4 with: configuration: .github/changelog_conf.json failOnError: true ignorePreReleases: true commitMode: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create release uses: softprops/action-gh-release@v1 with: body: ${{ steps.build_changelog.outputs.changelog }} prerelease: true files: | LICENSE fail_on_unmatched_files: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} build: name: build-${{ matrix.os }} if: always() needs: prepare-release runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ubuntu-20.04 cache_path: ~/.cabal/store asset_name: simplex-chat-ubuntu-20_04-x86-64 desktop_asset_name: simplex-desktop-ubuntu-20_04-x86_64.deb - os: ubuntu-22.04 cache_path: ~/.cabal/store asset_name: simplex-chat-ubuntu-22_04-x86-64 desktop_asset_name: simplex-desktop-ubuntu-22_04-x86_64.deb - os: macos-latest cache_path: ~/.cabal/store asset_name: simplex-chat-macos-x86-64 desktop_asset_name: simplex-desktop-macos-x86_64.dmg - os: windows-latest cache_path: C:/cabal asset_name: simplex-chat-windows-x86-64 desktop_asset_name: simplex-desktop-windows-x86_64.msi steps: - name: Configure pagefile (Windows) if: matrix.os == 'windows-latest' uses: al-cheb/configure-pagefile-action@v1.3 with: minimum-size: 16GB maximum-size: 16GB disk-root: "C:" - name: Clone project uses: actions/checkout@v3 - name: Setup Haskell uses: haskell/actions/setup@v2 with: ghc-version: "8.10.7" cabal-version: "latest" - name: Cache dependencies uses: actions/cache@v3 with: path: | ${{ matrix.cache_path }} dist-newstyle key: ${{ matrix.os }}-${{ hashFiles('cabal.project', 'simplex-chat.cabal') }} # / Unix - name: Unix prepare cabal.project.local for Mac if: matrix.os == 'macos-latest' shell: bash run: | echo "ignore-project: False" >> cabal.project.local echo "package direct-sqlcipher" >> cabal.project.local echo " extra-include-dirs: /usr/local/opt/openssl@1.1/include" >> cabal.project.local echo " extra-lib-dirs: /usr/local/opt/openssl@1.1/lib" >> cabal.project.local echo " flags: +openssl" >> cabal.project.local - name: Install AppImage dependencies if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-20.04' run: sudo apt install -y desktop-file-utils - name: Install pkg-config for Mac if: matrix.os == 'macos-latest' run: brew install pkg-config - name: Unix prepare cabal.project.local for Ubuntu if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' shell: bash run: | echo "ignore-project: False" >> cabal.project.local echo "package direct-sqlcipher" >> cabal.project.local echo " flags: +openssl" >> cabal.project.local - name: Unix build CLI id: unix_cli_build if: matrix.os != 'windows-latest' shell: bash run: | cabal build --enable-tests echo "::set-output name=bin_path::$(cabal list-bin simplex-chat)" - name: Unix upload CLI 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.unix_cli_build.outputs.bin_path }} asset_name: ${{ matrix.asset_name }} tag: ${{ github.ref }} - name: Setup Java if: startsWith(github.ref, 'refs/tags/v') uses: actions/setup-java@v3 with: distribution: 'corretto' java-version: '17' cache: 'gradle' - name: Linux build desktop id: linux_desktop_build if: startsWith(github.ref, 'refs/tags/v') && (matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04') shell: bash run: | scripts/desktop/build-lib-linux.sh cd apps/multiplatform ./gradlew packageDeb echo "::set-output name=package_path::$(echo $PWD/release/main/deb/simplex_*_amd64.deb)" - name: Linux make AppImage id: linux_appimage_build if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-20.04' shell: bash run: | scripts/desktop/make-appimage-linux.sh echo "::set-output name=appimage_path::$(echo $PWD/apps/multiplatform/release/main/*imple*.AppImage)" - name: Mac build desktop id: mac_desktop_build if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'macos-latest' shell: bash run: | scripts/desktop/build-lib-mac.sh cd apps/multiplatform ./gradlew packageDmg echo "::set-output name=package_path::$(echo $PWD/release/main/dmg/SimpleX-*.dmg)" - name: Linux upload desktop package to release if: startsWith(github.ref, 'refs/tags/v') && (matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04') uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.linux_desktop_build.outputs.package_path }} asset_name: ${{ matrix.desktop_asset_name }} tag: ${{ github.ref }} - name: Linux upload AppImage to release if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-20.04' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.linux_appimage_build.outputs.appimage_path }} asset_name: simplex-desktop-x86_64.AppImage tag: ${{ github.ref }} - name: Mac upload desktop package to release if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'macos-latest' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.mac_desktop_build.outputs.package_path }} asset_name: ${{ matrix.desktop_asset_name }} tag: ${{ github.ref }} - name: Unix test if: matrix.os != 'windows-latest' timeout-minutes: 30 shell: bash run: cabal test --test-show-details=direct # 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 - name: Windows build id: windows_build if: matrix.os == 'windows-latest' shell: cmd run: | cabal build --enable-tests cabal list-bin simplex-chat > tmp_bin_path set /p bin_path= < tmp_bin_path echo ::set-output name=bin_path::%bin_path% - 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.bin_path }} asset_name: ${{ matrix.asset_name }} tag: ${{ github.ref }} # Windows /