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 16, 2024
1 parent 60ee0a9 commit c90fd7e
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 75 deletions.
7 changes: 7 additions & 0 deletions .github/scripts/rename_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

machine=$(uname -m)
hw=$(uname -i)
os=$(uname -o | sed -En "s/GNU\/Linux/linux/p")

mv bin/shrun-ubuntu-latest "bin/shrun-$machine-$hw-$os"
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)
hw=$(uname -i)
os=$(uname -o | sed -En "s/GNU\/Linux/linux/p")

mv bin/shrun-ubuntu-latest "bin/shrun-$machine-$hw-$os"
186 changes: 111 additions & 75 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,100 +4,136 @@ on:
push:
branches:
- main
- release

pull_request:
branches:
- main
- release

workflow_dispatch:

jobs:
cabal:
# cabal:
# strategy:
# fail-fast: false
# matrix:
# ghc:
# - "9.4.8"
# - "9.6.3"
# - "9.8.1"
# os:
# - "macos-latest"
# - "ubuntu-latest"
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4

# - uses: haskell-actions/setup@v2
# with:
# ghc-version: ${{ matrix.ghc }}

# - name: Configure
# run: cabal configure --enable-tests --ghc-options -Werror

# - name: Compile
# run: cabal build lib:shrun

# - name: Unit Tests
# run: cabal test unit --test-options '--hedgehog-tests 100000'

# - name: Integration Tests
# run: cabal test integration

# - name: Functional Tests
# run: cabal test functional

# - name: Benchmarks
# if: ${{ matrix.os == 'ubuntu-latest' }}
# id: bench
# run: |
# cabal bench --benchmark-options '
# --csv benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv
# --svg benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg
# --baseline benchmarks/baseline_${{ matrix.os }}_${{ matrix.ghc }}_ci.csv
# --fail-if-slower 50
# --fail-if-faster 50'

# - uses: actions/upload-artifact@v3
# if: ${{ failure() && steps.bench.conclusion == 'failure' }}
# with:
# name: build-artifacts
# path: |
# benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv
# benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg
# nix:
# strategy:
# fail-fast: false
# matrix:
# os:
# - "macos-latest"
# - "ubuntu-latest"
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4

# - name: Setup nix
# uses: cachix/install-nix-action@v25
# with:
# github_access_token: ${{ secrets.GITHUB_TOKEN }}
# nix_path: nixpkgs=channel:nixos-unstable

# - name: Compile & Test
# run: nix build -L
# lint:
# runs-on: "ubuntu-latest"
# steps:
# - uses: actions/checkout@v4

# - name: Setup nix
# uses: cachix/install-nix-action@v25
# with:
# github_access_token: ${{ secrets.GITHUB_TOKEN }}
# nix_path: nixpkgs=channel:nixos-unstable

# - name: Formatting
# run: |
# nix run .#format
# git diff --exit-code --color=always

# - name: HLint
# run: nix run .#lint
release:
#needs: [cabal, nix, lint]
if: github.ref == 'refs/heads/release'
strategy:
fail-fast: false
matrix:
ghc:
- "9.4.8"
- "9.6.3"
- "9.8.1"
os:
- "macos-latest"
- "ubuntu-latest"
runs-on: ${{ matrix.os }}
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: ${{ matrix.ghc }}
ghc-version: "9.6.3"

- name: Configure
run: cabal configure --enable-tests --ghc-options -Werror
# 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: Compile
run: cabal build lib:shrun

- name: Unit Tests
run: cabal test unit --test-options '--hedgehog-tests 100000'

- name: Integration Tests
run: cabal test integration

- name: Functional Tests
run: cabal test functional

- name: Benchmarks
if: ${{ matrix.os == 'ubuntu-latest' }}
id: bench
- name: Install binary
run: |
cabal bench --benchmark-options '
--csv benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv
--svg benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg
--baseline benchmarks/baseline_${{ matrix.os }}_${{ matrix.ghc }}_ci.csv
--fail-if-slower 50
--fail-if-faster 50'
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.bench.conclusion == 'failure' }}
with:
name: build-artifacts
path: |
benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv
benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg
nix:
strategy:
fail-fast: false
matrix:
os:
- "macos-latest"
- "ubuntu-latest"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Setup nix
uses: cachix/install-nix-action@v25
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable

- name: Compile & Test
run: nix build
lint:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
cabal install --installdir=bin --install-method=copy --program-suffix=-${{ matrix.platform.os }}
.github/scripts/${{ matrix.platform.renamer }}
- name: Setup nix
uses: cachix/install-nix-action@v25
- name: Upload binary
uses: actions/upload-artifact@v3
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable

- name: Formatting
run: |
nix run .#format
git diff --exit-code --color=always
- name: HLint
run: nix run .#lint
name: build-artifacts
path: bin

0 comments on commit c90fd7e

Please sign in to comment.