Skip to content

Commit

Permalink
ci: add step to build static binary
Browse files Browse the repository at this point in the history
  • Loading branch information
stevana committed Oct 21, 2024
1 parent 513e365 commit 0fa5627
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 13 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,27 @@ jobs:
- name: Build documentation
run: cabal haddock all

- name: Create new git tag, if merge to master and .cabal version is bumped
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: sol/haskell-autotag@v1
id: autotag
- name: Build static binary
run: |
cd release && \
docker run \
-v "${PWD}/..":/mnt/:ro \
-v "~/.cabal/packages":/root/.cache/cabal/packages \
-v "~/cabal/store":/root/.local/state/cabal/store \
-v "${PWD}/dist-newstyle":/mnt/dist-newstyle \
ghcr.io/spex-lang/spex-static-build
- name: Create tarball
run: cabal sdist
# - name: Create new git tag, if merge to master and .cabal version is bumped
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# uses: sol/haskell-autotag@v1
# id: autotag

- uses: haskell-actions/[email protected]
with:
# http://hackage.haskell.org/users/account-management
hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
publish: true
if: steps.autotag.outputs.created
# - name: Create tarball
# run: cabal sdist

# - uses: haskell-actions/[email protected]
# with:
# # http://hackage.haskell.org/users/account-management
# hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
# publish: true
# if: steps.autotag.outputs.created
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Spex

![Build status](https://github.com/spex-lang/spex/actions/workflows/main.yaml/badge.svg)

Spex is a programming language for working with specifications.

> [!CAUTION]
Expand Down Expand Up @@ -103,12 +105,32 @@ cabal install spex spex-demo-petstore
- getPet : GET /pet/{petId : Int} -> Pet
+ addPet : POST /pet !Pet
+ getPet : GET /pet/{petId : @Int} -> Pet
$ spex example/petstore-modal.spex
cabal run spex -- example/petstore-modal.spex

i Verifying the deployment: http://localhost:8080
against the specification: example/petstore-modal.spex

i Parsing the specification.

i Waiting for health check to pass.

i Starting to run tests.

i All tests passed, here are the results:

failing tests: []
client errors: 3
coverage: fromList [(OpId "addPet",51),(OpId "getPet",49)]
```
</details>

Notice how many fewer 404 errors we get for `getPet` now, because of the
abstract (`@`) annotation on `petId`.

Where an abstract type isn't generated, i.e. gets reused, and a unique type
is always generated and never reused. Without any annotation a coin is
flipped and the value either gets reused or generated.
</details>

- [ ] Keep track of previous responses and try to use them during generation

Expand Down Expand Up @@ -178,6 +200,7 @@ cabal install spex spex-demo-petstore

* Refinement types, e.g. `/pet/{petId : Int | petId > 0}` and ability to generate
validation logic from them
- [Refinement Types: A Tutorial](https://arxiv.org/abs/2010.07763v1) (2021)

* Use templating and (Lua?) extensions for doc/code generation from
spec, a bit similar to how pandoc does it.
Expand Down

0 comments on commit 0fa5627

Please sign in to comment.