Skip to content

Commit

Permalink
Merge pull request #454 from sorki/srk/ci
Browse files Browse the repository at this point in the history
CI, Readme, CHANGELOG
  • Loading branch information
julialongtin committed Nov 26, 2023
2 parents 2d026d3 + dd38987 commit 237c027
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 78 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/ci.dhall
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
let haskellCi = https://raw.githubusercontent.com/sorki/github-actions-dhall/pending/haskell-ci.dhall
let haskellCi =
https://raw.githubusercontent.com/sorki/github-actions-dhall/main/haskell-ci.dhall

in haskellCi.generalCi
haskellCi.matrixSteps
( Some
{ ghc =
[ haskellCi.GHC.GHC947
, haskellCi.GHC.GHC902
, haskellCi.GHC.GHC8107
]
, cabal = [ haskellCi.Cabal.Cabal310 ]
}
)
// { on = [ haskellCi.Event.push
, haskellCi.Event.pull_request ]
}
(haskellCi.withHlint haskellCi.defaultCabalSteps)
(haskellCi.DhallMatrix::{=} with ghc = haskellCi.defaultGHC3)
: haskellCi.CI.Type
10 changes: 6 additions & 4 deletions .github/workflows/ci.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env bash
# Script by @fisx

set -eo pipefail

# cd into the dir where this script is placed
cd "$( dirname "${BASH_SOURCE[0]}" )"

echo "regenerating .github/workflows/ci.yaml..."
echo "regenerating .github/workflows/ci.yaml"

# based on https://github.com/vmchale/github-actions-dhall
which dhall-to-yaml || cabal install dhall-yaml
dhall-to-yaml --file ci.dhall > ci.yaml
which dhall-to-yaml-ng || cabal install dhall-yaml
dhall-to-yaml-ng --generated-comment --file ci.dhall > ci.yaml
87 changes: 49 additions & 38 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
# Code generated by dhall-to-yaml. DO NOT EDIT.
jobs:
build:
runs-on: ubuntu-latest
name: "GHC ${{ matrix.ghc }}, Cabal ${{ matrix.cabal }}, OS ${{ matrix.os }}"
"runs-on": "${{ matrix.os }}"
steps:
- uses: "actions/checkout@v3"
- id: setup-haskell-cabal
uses: "haskell-actions/setup@v2"
with:
cabal-version: "${{ matrix.cabal }}"
enable-stack: false
ghc-version: "${{ matrix.ghc }}"
- name: Update Hackage repository
run: cabal update
- name: cabal.project.local.ci
run: |
if [ -e cabal.project.local.ci ]; then
cp cabal.project.local.ci cabal.project.local
fi
- name: freeze
run: cabal freeze --enable-tests --enable-benchmarks
- uses: "actions/cache@v3"
with:
key: "${{ runner.os }}-${{ matrix.ghc }}-cabal-${{ hashFiles('cabal.project.freeze') }}"
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
- name: Install dependencies
run: cabal build all --enable-tests --enable-benchmarks --only-dependencies
- name: build all
run: cabal build all --enable-tests --enable-benchmarks
- name: test all
run: cabal test all --enable-tests
- name: haddock all
run: cabal haddock all
- uses: "actions/checkout@v4"
with:
submodules: recursive
- id: "setup-haskell-cabal"
uses: "haskell-actions/setup@v2"
with:
"cabal-version": "${{ matrix.cabal }}"
"ghc-version": "${{ matrix.ghc }}"
- name: Update Hackage repository
run: cabal update
- name: cabal.project.local.ci
run: |
if [ -e cabal.project.local.ci ]; then
cp cabal.project.local.ci cabal.project.local
fi
- name: freeze
run: "cabal freeze --enable-tests --enable-benchmarks"
- uses: "actions/cache@v3"
with:
key: "${{ matrix.os }}-${{ matrix.ghc }}-${{ matrix.cabal}}-${{ hashFiles('cabal.project.freeze') }}"
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
- name: Install dependencies
run: "cabal build all --enable-tests --enable-benchmarks --only-dependencies"
- name: build all
run: "cabal build all --enable-tests --enable-benchmarks"
- name: test all
run: "cabal test all --enable-tests"
- name: haddock all
run: cabal haddock all
- name: "Install and run hlint (optional)"
run: |
cabal install hlint
hlint -g --no-exit-code
strategy:
matrix:
cabal:
- '3.10'
- '3.10'
ghc:
- '9.4.7'
- '9.0.2'
- '8.10.7'
- '9.6.3'
- '9.4.7'
- '9.2.8'
os:
- "ubuntu-latest"
name: Haskell CI
on:
- push
- pull_request
'on':
pull_request: {}
push: {}
schedule:
- cron: "4 20 10 * *"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Fixing an off by one error in variable stack lookups. [#431](https://github.com/Haskell-Things/ImplicitCAD/issues/431)
* Fixing exponent operator precedence. [#428](https://github.com/Haskell-Things/ImplicitCAD/issues/428)
* Fixing some crashes relating to unclosed loops when generating surfaces. [#373](https://github.com/Haskell-Things/ImplicitCAD/issues/373)
* Addition of canonicalization pass and `canonicalize` member function for `Object` [#445](https://github.com/Haskell-Things/ImplicitCAD/pulls/445)

# Version [0.4.0.0](https://github.com/Haskell-Things/ImplicitCAD/compare/v0.3.0.0...v0.4.0.0) (2022-06-06)

Expand Down
6 changes: 3 additions & 3 deletions Graphics/Implicit/Definitions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ where

import GHC.Generics (Generic)

import Prelude (Foldable, Functor(fmap), (.), Num, Ord, Eq, atan2, asin, pi, (>=), signum, abs, (+), (-), RealFloat, (==), ($), flip, Semigroup((<>)), Monoid (mempty), Double, Either(Left, Right), Bool(True, False), (*), (/), fromIntegral, Float, realToFrac, (&&), RealFloat(isNaN), (||), or)
import Prelude (Foldable, Num, Ord, Eq, atan2, asin, pi, (>=), signum, abs, (+), (-), RealFloat, (==), ($), flip, Semigroup((<>)), Monoid (mempty), Double, Either(Left, Right), Bool(True, False), (*), (/), fromIntegral, Float, realToFrac, (&&), RealFloat(isNaN), (||), any)

import Graphics.Implicit.FastIntUtil as F (Fastℕ(Fastℕ), fromFastℕ, toFastℕ)

Expand Down Expand Up @@ -431,7 +431,7 @@ quaternionToEuler (Quaternion w (V3 x y z))=

-- | Returns True if any component of a foldable functor is zero
hasZeroComponent
:: (Foldable f, Functor f, Num a, Eq a)
:: (Foldable f, Num a, Eq a)
=> f a
-> Bool
hasZeroComponent = or . fmap (==0)
hasZeroComponent = any (==0)
4 changes: 3 additions & 1 deletion Graphics/Implicit/ExtOpenScad/Eval/Constant.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import Graphics.Implicit.ExtOpenScad.Eval.Expr (evalExpr, matchPat, rawRunExpr)

import Graphics.Implicit.ExtOpenScad.Default (defaultObjects)

import Control.Monad.State (liftIO, (>>=))
import Control.Monad ((>>=))

import Control.Monad.IO.Class (liftIO)

import System.Directory (getCurrentDirectory)

Expand Down
2 changes: 1 addition & 1 deletion Graphics/Implicit/ExtOpenScad/Eval/Statement.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ runStatementI (StatementI sourcePos (ModuleCall (Symbol name) argsExpr suite)) =
((_, suiteInfoFound):_) -> suiteInfoFound
when (null possibleInstances) (do
errorC sourcePos $ "no instance of " <> name <> " found to match given parameters.\nInstances available:\n" <> pack (show (ONModule (Symbol name) implementation forms))
traverse_ (`checkOptions` True) $ fmap (Just . fst) forms
traverse_ ((`checkOptions` True) . Just . fst) forms
)
-- Ignore this for now, because all instances we define have the same suite requirements.
{-
Expand Down
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ImplicitCAD: Math Inspired CAD
==============================
# ImplicitCAD: Math Inspired CAD

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Haskell-Things/ImplicitCAD/ci.yaml?branch=master)](https://github.com/Haskell-Things/ImplicitCAD/actions/workflows/ci.yaml) [![Hackage version](https://img.shields.io/hackage/v/implicit.svg?color=success)](https://hackage.haskell.org/package/implicit) [![IRC](https://img.shields.io/badge/irc.libera.chat-%23ImplicitCAD-blue.svg)](https://libera.chat/)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Haskell-Things/ImplicitCAD/ci.yaml?branch=master)](https://github.com/Haskell-Things/ImplicitCAD/actions/workflows/ci.yaml)
[![Hackage version](https://img.shields.io/hackage/v/implicit.svg?color=success)](https://hackage.haskell.org/package/implicit)
[![IRC](https://img.shields.io/badge/irc.libera.chat-%23ImplicitCAD-blue.svg)](https://libera.chat/)
[![Dependencies](https://img.shields.io/hackage-deps/v/implicit?label=Dependencies)](https://packdeps.haskellers.com/feed?needle=implicit)

Introduction
------------
## Introduction

ImplicitCAD is a programmatic CAD program, implemented in Haskell. Unlike traditional CAD programs, programmatic CAD programs use text descriptions of objects, as in programming. Concepts like variables, control structures and abstraction are used, just as in programming. This provides a number of advantages:

Expand All @@ -22,8 +23,7 @@ It also directly provides some GCode generation, and has a parser for OpenSCAD t
ImplicitCAD is very much a work in progress. The author considers it ready for beta testers and greatly appreciates bug reports.


ExtOpenSCAD Examples
--------------------
## ExtOpenSCAD Examples

Let's begin with OpenSCAD examples, since they're likely a more comfortable format than Haskell for most readers :)

Expand Down Expand Up @@ -186,8 +186,7 @@ And some higher order functions, like my friend map:
echo(map(cos, [0, pi/2, pi]));
```

Haskell Examples
-----------------
## Haskell Examples

Everything you saw above can be done with the Haskell API. For example, a simple 2D example, the same as our first ExtOpenSCAD one:

Expand Down Expand Up @@ -240,8 +239,7 @@ main = writeSTL 1 "test.stl" out

You can do a whole lot more!

Try ImplicitCAD!
----------------
## Try ImplicitCAD!

1. Install GHC and cabal.
* Debain/Ubuntu: `apt-get install ghc cabal-install zlib1g-dev`
Expand Down Expand Up @@ -283,24 +281,21 @@ Try ImplicitCAD!
anywhere with the `-Ldir` or `-llib` options. Alternatively, some people have
permanently fixed this by doing the cabal install as root.

Documentation
-------------
## Documentation

Documentation can be generated from the source code of ImplicitCAD by Haddock by running `cabal haddock`.

Releases of ImplicitCAD are uploaded to HackageDB which, in addition to making them avaialable through `cabal install`, puts the generated documentation on the Internet. So you can read the documentation for the most recent release of ImplicitCAD, 0.4.0.0, [on HackageDB](http://hackage.haskell.org/packages/archive/implicit/0.4.0.0/doc/html/Graphics-Implicit.html).

In Implicit CAD, we consider objects as functions of `outwardness'. The boundary is 0, negative is the interior and positive the exterior. The magnitude is how far out or in. A description of the mathematical ideas underpinning ImplicitCAD are in a [blog post on colah's blog](http://christopherolah.wordpress.com/2011/11/06/manipulation-of-implicit-functions-with-an-eye-on-cad/).

Related projects
----------------
## Related projects

* [ExplicitCAD](https://github.com/kliment/explicitcad/)
* [HSlice](https://github.com/Haskell-Things/hslice/)
* [implicitpipe](https://github.com/Haskell-Things/implicitpipe/)

Status
------
## Status

ImplicitCAD is very much a work in progress.

Expand Down

0 comments on commit 237c027

Please sign in to comment.