Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lots of changes #8

Merged
merged 9 commits into from
Oct 15, 2024
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
24 changes: 6 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
deno:
- v1.x
- v2.x
- canary
os:
- ubuntu-latest
Expand All @@ -29,19 +29,13 @@ jobs:
uses: actions/checkout@v4

- name: Set up Deno
uses: denoland/setup-deno@v1
uses: denoland/setup-deno@v2
with:
deno-version: ${{ matrix.deno }}

- name: Run tests
run: deno task test

- name: Run tests (simulate Deno 2)
if: matrix.deno == 'canary'
run: deno task test
env:
DENO_FUTURE: 1

- name: Generate lcov
run: deno task cov:gen

Expand All @@ -53,30 +47,24 @@ jobs:
name: ${{ matrix.os }}-${{ matrix.deno }}

check:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Deno
uses: denoland/setup-deno@v1
uses: denoland/setup-deno@v2
with:
deno-version: canary

- name: Format & Lint
run: deno task check

- name: Build
run: deno task build:check
run: deno task build:wasm:check

publish-dry-run:
runs-on: ubuntu-latest
Expand All @@ -90,7 +78,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Deno
uses: denoland/setup-deno@v1
uses: denoland/setup-deno@v2
with:
deno-version: canary

Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/version_bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: version_bump

permissions:
contents: write
pull-requests: write

on: workflow_dispatch

jobs:
build:
name: version bump
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: canary

- name: Run version bump
run: |
git fetch --unshallow origin
deno run -A jsr:@deno/bump-workspaces@^0.1/cli
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_USER_NAME: ${{ github.actor }}
GIT_USER_EMAIL: ${{ github.actor}}@users.noreply.github.com
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: publish
name: workspace publish

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish:
Expand All @@ -18,15 +19,15 @@ jobs:
uses: actions/checkout@v4

- name: Set up Deno
uses: denoland/setup-deno@v1
uses: denoland/setup-deno@v2
with:
deno-version: canary

- name: Format & Lint
run: deno task check

- name: Build
run: deno task build:check
run: deno task build:wasm:check

- name: Test
run: deno task test
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.idea
.vscode/settings.json
.vscode/*
!.vscode/settings.json
.fleet
.vim
**/cov/
Expand All @@ -9,4 +10,4 @@ html_cov/
cov.lcov
coverage/
docs/
crypto/hash/_wasm/target
_wasm/target
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"deno.enable": true,
"deno.unstable": true
}
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ console.log(dump(buffer));
utility for text encoding.
- [http](https://jsr.io/@stdext/http): The http package contains utility for
fetching and http servers
- [json](https://jsr.io/@stdext/json): The json package, contains helpers for
json parsing, querying (jsonpath) and processing
- [lexer](https://jsr.io/@stdext/lexer): The lexer package contains general
purpose lexers/tokenizers
- [types](https://jsr.io/@stdext/types): The types package, contains general
purpose type helpers

## Versioning

Expand All @@ -68,6 +74,21 @@ implemented.
For modules that use Rust to compile to WASM, we allow the usage of third-party
crates if necessary, but this will be considered on a case-by-case basis.

## WASM

All wasm code is generated from the rust workspace in the [\_wasm](./_wasm)
folder.

To generate the wasm code:

```sh
deno task build:wasm
```

This will call the [build_wasm.ts](./_tools/build_wasm.ts) script and will place
each generated lib in its respective package based on its prefix. See script for
more details.

## Deprecation Policy

We follow the
Expand Down
51 changes: 51 additions & 0 deletions _tools/build_wasm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { parse } from "@std/toml";
import { resolve } from "@std/path";

const isCheck = Deno.args.some((a) => a === "--check");
const failFast = Deno.args.some((a) => a === "--fail-fast");

const rawCargo = Deno.readTextFileSync("./_wasm/Cargo.toml");

const parsedCargo = parse(rawCargo) as { workspace: { members: string[] } };

let didFail = false;

for (const member of parsedCargo.workspace.members) {
const [folder] = member.split("_");
const outPath = resolve(
folder,
"_wasm",
);

const args: string[] = [
"run",
"-A",
"jsr:@deno/wasmbuild@0.17.1",
"--js-ext",
"mjs",
"--sync",
"--project",
member,
"--out",
outPath,
];

if (isCheck) {
args.push("--check");
}

const command = new Deno.Command(Deno.execPath(), {
args: args,
cwd: "./_wasm",
});
const child = command.spawn();
const status = await child.status;
if (!status.success) {
didFail = true;
}
if (failFast && didFail) {
Deno.exit(1);
}
}

Deno.exit(didFail ? 1 : 0);
33 changes: 0 additions & 33 deletions _tools/bump_version.ts

This file was deleted.

File renamed without changes.
Loading