diff --git a/.github/scripts/rename_linux.sh b/.github/scripts/rename_linux.sh new file mode 100755 index 00000000..6ebc3b7c --- /dev/null +++ b/.github/scripts/rename_linux.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +machine=$(uname -m) # x86_64 +hw=$(uname -i) # unknown +os=$(uname -s | tr '[:upper:]' '[:lower:]') # linux +kernel_release=$(uname -r) # 6.1.78 + +mv bin/shrun-ubuntu-latest "bin/shrun-$machine-$hw-$os-$kernel_release" \ No newline at end of file diff --git a/.github/scripts/rename_osx.sh b/.github/scripts/rename_osx.sh new file mode 100755 index 00000000..40ae877c --- /dev/null +++ b/.github/scripts/rename_osx.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +machine=$(uname -m) # x86_64 +os=$(uname -s | tr '[:upper:]' '[:lower:]') # darwin +os_release=$(uname -r) # 21.6.0 + +mv bin/shrun-macos-latest "bin/shrun-$machine-$os-$os_release" \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7985bb15..2a7b6b88 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,10 +4,12 @@ on: push: branches: - main + - release pull_request: branches: - main + - release workflow_dispatch: @@ -82,7 +84,7 @@ jobs: nix_path: nixpkgs=channel:nixos-unstable - name: Compile & Test - run: nix build + run: nix build -L lint: runs-on: "ubuntu-latest" steps: @@ -101,3 +103,39 @@ jobs: - name: HLint run: nix run .#lint + release: + needs: [cabal, nix, lint] + if: github.ref == 'refs/heads/release' + strategy: + fail-fast: false + matrix: + platform: + - os: "macos-latest" + renamer: rename_osx.sh + - os: "ubuntu-latest" + renamer: rename_linux.sh + runs-on: ${{ matrix.platform.os }} + steps: + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 + with: + ghc-version: "9.6.3" + + - name: Configure + # TODO: It would be nice if we could figure out static binaries. + # This doesn't appear to work, according to ldd. + run: cabal configure --enable-executable-static --enable-executable-stripping --ghc-options -Werror + + - name: Install binary + run: | + cabal install --installdir=bin --install-method=copy --program-suffix=-${{ matrix.platform.os }} + .github/scripts/${{ matrix.platform.renamer }} + + ls bin + + - name: Upload binary + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: bin diff --git a/test/functional/Functional/Buffering.hs b/test/functional/Functional/Buffering.hs index ccd31698..3e8230ac 100644 --- a/test/functional/Functional/Buffering.hs +++ b/test/functional/Functional/Buffering.hs @@ -59,8 +59,9 @@ logsNoBuffer = withTimerPrefix "3 seconds", withCommandPrefix cmdPrefix "3.5", withTimerPrefix "4 seconds", - withSuccessPrefix cmdPrefix <> "4 seconds", - withFinishedPrefix "4 seconds" + -- No seconds here because it is flaky (e.g. can be either 4/5 seconds) + withSuccessPrefix cmdPrefix, + withFinishedPrefix "" ] assertLogsEq :: List Text -> List Text -> IO ()