Skip to content

Commit

Permalink
Add release job
Browse files Browse the repository at this point in the history
  • Loading branch information
tbidne committed Mar 17, 2024
1 parent 60ee0a9 commit 4bcf1a2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .github/scripts/rename_linux.sh
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 7 additions & 0 deletions .github/scripts/rename_osx.sh
Original file line number Diff line number Diff line change
@@ -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"
40 changes: 39 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
push:
branches:
- main
- release

pull_request:
branches:
- main
- release

workflow_dispatch:

Expand Down Expand Up @@ -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:
Expand All @@ -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
5 changes: 3 additions & 2 deletions test/functional/Functional/Buffering.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down

0 comments on commit 4bcf1a2

Please sign in to comment.