Skip to content
Merged
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
45 changes: 13 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
pull_request:
branches: [main]

# Run CI on all 3 latest OSes
jobs:
build:
strategy:
Expand All @@ -17,53 +16,35 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Set up Node toolchain
uses: actions/setup-node@v3
uses: actions/setup-node@v6
with:
node-version: "16"

- name: Cache NPM dependencies
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
node-version: "24"
cache: npm

- name: Setup PureScript tooling
run:
npm i -g purescript@latest purs-tidy@latest purescript-psa@latest spago@latest
run: npm ci

- name: Cache PureScript dependencies
uses: actions/cache@v3
uses: actions/cache@v5
with:
key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
key: ${{ runner.os }}-spago-${{ hashFiles('spago.yaml', 'spago.lock', 'package-lock.json') }}
path: |
.spago
output

# Compile the library/project
# censor-lib: ignore warnings emitted by dependencies
# strict: convert warnings into errors
# Note: `purs-args` actually forwards these args to `psa`
- name: Build the project
run: |
npx spago build --purs-args "--censor-lib --strict"
run: npm run build

- name: Run tests
run: |
chmod +x test/regen-pem-files.sh
sh test/regen-pem-files.sh
run: npm test

npx spago -x test.dhall test
- name: Lint JavaScript
if: runner.os == 'Linux'
run: npm run lint

- name: Check Formatting
if: runner.os == 'Linux'
run: |
purs-tidy check src test
run: npm run format:check
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
/.psa*
/.spago
/.vscode
/test/localhost-cert.pem
/test/localhost-privkey.pem
3 changes: 3 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "es5"
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ PureScript bindings to the `http2` Node.js module

The bindings for the module have been implemented, excluding the [Compatibility API](https://nodejs.org/dist/latest-v18.x/docs/api/http2.html#compatibility-api).

This repo is incompatible with existing `node-streams` and `node-net` bindings in the default package set. Instead, this repo uses custom forks of [`node-streams@update-ffi-build-on-node-event-emitters`](https://github.com/purescript-node/purescript-node-streams/tree/update-ffi-build-on-node-event-emitters) and [`node-net@fully-implement`](https://github.com/purescript-node/purescript-node-net/tree/fully-implement) that implement their event handlers using the bindings exposed via [`node-event-emitter`](https://github.com/purescript-node/purescript-node-event-emitter). See the [packages.dhall](./packages.dhall) file to see how to refer to these forks if you want to use this repo.
Install the package with Spago:

```sh
spago install node-http2
```

The bindings written thus far are mostly safe. There are a few cases where safety cannot be properly handled in PureScript due to some decisions made by Node.js. In other cases, it's not yet clear to me whether to represent something as `foreign import data`, `Object`, and/or an `ADT`.
Loading
Loading