Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 32 additions & 82 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ name: Haskell CI

on:
push:
branches:
- '*'
pull_request:
branches: [ "master" ]
workflow_dispatch:

permissions:
contents: read

jobs:
fourmolu:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: haskell-actions/run-fourmolu@v9
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: haskell-actions/run-fourmolu@3b7702b41516aa428dfe6e295dc73476ae58f69e # v11
with:
version: "0.14.0.0"
build:
Expand All @@ -27,104 +23,58 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
ghc-version: ['9.6', '9.4', '9.2', '9.0']
ghc-version: ["9.12", "9.10", "9.8", "9.6", "9.4", "9.2"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@96f3dafd067155f32643c2a0757ab71d2910e2c2 # v2.8.0
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}
enable-stack: true

- name: Installed minor versions of GHC, Cabal, and Stack
shell: bash
run: |
GHC_VERSION=$(ghc --numeric-version)
CABAL_VERSION=$(cabal --numeric-version)
STACK_VERSION=$(stack --numeric-version)
echo "GHC_VERSION=${GHC_VERSION}" >> "${GITHUB_ENV}"
echo "CABAL_VERSION=${CABAL_VERSION}" >> "${GITHUB_ENV}"
echo "STACK_VERSION=${STACK_VERSION}" >> "${GITHUB_ENV}"

- name: Check cabal file
run: cabal check

- name: Configure the build
run: |
# cabal configure --enable-tests --enable-benchmarks --disable-documentation
# cabal build --dry-run
stack build --test --bench --no-haddock --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.

- name: Restore .stack-work cache
uses: actions/cache/restore@v3
id: cache-restore-stack-work
with:
path: .stack-work
key: ${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-stack-${{ env.STACK_VERSION }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-stack-${{ env.STACK_VERSION }}-stack-work-

- name: Restore ~/.stack cache (Unix)
uses: actions/cache/restore@v3
id: cache-restore-stack-global-unix
if: runner.os == 'Linux' || runner.os == 'macOS'
with:
path: ~/.stack
key: ${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-stack-${{ env.STACK_VERSION }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-stack-${{ env.STACK_VERSION }}-stack-global-

- name: Restore %APPDATA%\stack, %LOCALAPPDATA%\Programs\stack cache (Windows)
uses: actions/cache/restore@v3
id: cache-restore-stack-global-windows
if: runner.os == 'Windows'
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build --dry-run

- name: Restore cached dependencies
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: |
~\AppData\Roaming\stack
~\AppData\Local\Programs\stack
key: ${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-stack-${{ env.STACK_VERSION }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-stack-${{ env.STACK_VERSION }}-stack-global-
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-

- name: Build dependencies
run: stack build --only-dependencies
run: cabal build --only-dependencies

- name: Build the package
run: stack build

- name: Save .stack-work cache
uses: actions/cache/save@v3
id: cache-save-stack-work
if: steps.cache-restore-stack-work.outputs.cache-hit != 'true'
with:
path: .stack-work
key: ${{ steps.cache-restore-stack-work.outputs.cache-primary-key }}

- name: Save %APPDATA%\stack, %LOCALAPPDATA%\Programs\stack cache (Windows)
uses: actions/cache/save@v3
if: runner.os == 'Windows'
&& steps.cache-restore-stack-global-windows.outputs.cache-hit != 'true'
- name: Save cached dependencies
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
~\AppData\Roaming\stack
~\AppData\Local\Programs\stack
key: ${{ steps.cache-restore-stack-global-windows.outputs.cache-primary-key }}

- name: Save ~/.stack cache (Unix)
uses: actions/cache/save@v3
id: cache-save-stack-global
if: (runner.os == 'Linux' || runner.os == 'macOS')
&& steps.cache-restore-stack-global-unix.outputs.cache-hit != 'true'
with:
path: ~/.stack
key: ${{ steps.cache-restore-stack-global-unix.outputs.cache-primary-key }}
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Run tests
run: stack test
- name: Build the package
run: cabal build all

- name: Check cabal file
run: cabal check
- name: Run tests
run: cabal test all

- name: Build documentation
run: stack haddock
run: cabal haddock all --disable-documentation
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*~
dist-*/
.vscode/*
.direnv/*
.envrc
18 changes: 18 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

## Unreleased changes

- **BREAKING CHANGE**: Restructured `VarDomain` type to support upper bounds
- Replaced `NonNegative`, `LowerBound SimplexNum`, and `Unbounded` constructors with
a single `Bounded { lowerBound :: Maybe SimplexNum, upperBound :: Maybe SimplexNum }` record
- Added smart constructors for convenience: `unbounded`, `nonNegative`, `lowerBoundOnly`,
`upperBoundOnly`, and `boundedRange`
- `Bounded Nothing Nothing` is equivalent to `Unbounded`
- `Bounded (Just 0) Nothing` is equivalent to `NonNegative`
- Upper bounds are now supported and automatically added as LEQ constraints
- Added `AddUpperBound` constructor to `VarTransform` for upper bound constraint generation
- Updated `getTransform` to return a list of transforms (can now generate both lower and upper bound transforms)
- Use Hspec for tests
- Add nix flake
- twoPhaseSimplex now takes a VarDomainMap (as the first param)
- You can specify each Var's domain using smart constructors: `nonNegative`, `unbounded`,
`lowerBoundOnly`, `upperBoundOnly`, or `boundedRange`
- If a VarDomain for a Var is undefined, it's assumed to be `unbounded`
- If you want to keep the same behaviour as before (all vars non-negative), use `nonNegative` for all Vars

## [v0.2.0.0](https://github.com/rasheedja/LPPaver/tree/v0.2.0.0)

- Setup CI
Expand Down
Loading
Loading