Skip to content

Commit

Permalink
Add hpke/core as a core HPKE module which has no dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
dajiaji committed Jul 28, 2023
1 parent 8f3fa8e commit 862bb8f
Show file tree
Hide file tree
Showing 27 changed files with 2,529 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.lcov
flags: unittests
- name: Run deno test for /core
working-directory: ./core
run: |
deno fmt --check
deno task test
- name: Run deno test for /x/dhkem-secp256k1
working-directory: ./x/dhkem-secp256k1
run: |
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/ci_browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ jobs:
npm install -g esbuild
deno task dnt
deno task minify > test/runtimes/browsers/pages/src/hpke.js
mkdir test/runtimes/browsers/pages/core
cp -rf core/test/runtimes/browsers/pages/* test/runtimes/browsers/pages/core
mkdir test/runtimes/browsers/pages/dhkem-secp256k1
cp -rf x/dhkem-secp256k1/test/runtimes/browsers/pages/* test/runtimes/browsers/pages/dhkem-secp256k1
deno task minify > test/runtimes/browsers/pages/dhkem-secp256k1/src/hpke.js
- working-directory: ./core
run: |
deno task dnt
deno task minify > ../test/runtimes/browsers/pages/core/src/hpke-core.js
- working-directory: ./x/dhkem-secp256k1
run: |
deno task dnt
Expand All @@ -38,7 +44,7 @@ jobs:

playwright-test:
needs: pages
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -48,5 +54,7 @@ jobs:
npm ci
npx playwright install --with-deps
npx playwright test
- working-directory: ./core/test/runtimes/browsers
run: npm install && npx playwright install && npx playwright test
- working-directory: ./x/dhkem-secp256k1/test/runtimes/browsers
run: npm install && npx playwright install && npx playwright test
18 changes: 14 additions & 4 deletions .github/workflows/ci_bun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ jobs:
deno task dnt
deno task minify > test/runtimes/hpke.js
deno task minify > x/dhkem-secp256k1/test/runtimes/hpke.js
- working-directory: ./x/dhkem-secp256k1/
run: |
deno task dnt
deno task minify > test/runtimes/hpke-dhkem-secp256k1.js
- uses: antongolub/action-setup-bun@v1
with:
bun-version: ${{ matrix.bun-version }}
Expand All @@ -43,6 +39,20 @@ jobs:
nohup bun src/index.js &
sleep 3
deno test hpke.spec.ts --allow-net
- working-directory: ./core/
run: |
deno task dnt
deno task minify > test/runtimes/hpke-core.js
- name: Run test for core
working-directory: ./core/test/runtimes/bun
run: |
nohup bun src/index.js &
sleep 3
deno test core.spec.ts --allow-net
- working-directory: ./x/dhkem-secp256k1/
run: |
deno task dnt
deno task minify > test/runtimes/hpke-dhkem-secp256k1.js
- name: Run test for dhkem-secp256k1
working-directory: ./x/dhkem-secp256k1/test/runtimes/bun
run: |
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/ci_cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,30 @@ jobs:
npm install -g esbuild
deno task dnt
deno task minify > test/runtimes/hpke.js
deno task minify > core/test/runtimes/hpke.js
deno task minify > x/dhkem-secp256k1/test/runtimes/hpke.js
- working-directory: ./x/dhkem-secp256k1/
run: |
deno task dnt
deno task minify > test/runtimes/hpke-dhkem-secp256k1.js
- name: Run test
working-directory: ./test/runtimes/cloudflare
run: |
npm install
nohup npm start &
sleep 3
deno test hpke.spec.ts --allow-net
- working-directory: ./core/
run: |
deno task dnt
deno task minify > test/runtimes/hpke-core.js
- name: Run test for core
working-directory: ./core/test/runtimes/cloudflare
run: |
npm install
nohup npm start &
sleep 3
deno test core.spec.ts --allow-net
- working-directory: ./x/dhkem-secp256k1/
run: |
deno task dnt
deno task minify > test/runtimes/hpke-dhkem-secp256k1.js
- name: Run test for dhkem-secp256k1
working-directory: ./x/dhkem-secp256k1/test/runtimes/cloudflare
run: |
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
npm install -g esbuild
deno task dnt
deno task minify > ./npm/hpke.min.js
- name: Run dnt & minify for /core
working-directory: ./core
run: |
deno task dnt
deno task minify > ./npm/hpke-core.min.js
- name: Run dnt & minify for /x/dhkem-secp256k1
working-directory: ./x/dhkem-secp256k1
run: |
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Run dnt & minify
working-directory: ./core
run: |
npm install -g esbuild
deno task dnt
deno task minify > ./npm/hpke-core.min.js
- working-directory: ./core/npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-dhkem-secp256k1:
runs-on: ubuntu-latest
steps:
Expand Down
Empty file added core/README.md
Empty file.
35 changes: 35 additions & 0 deletions core/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"imports": {
"testing/": "https://deno.land/[email protected]/testing/",
"dnt": "https://deno.land/x/[email protected]/mod.ts"
},
"fmt": {
"include": [
"README.md",
"deno.json",
"dnt.ts",
"mod.ts",
"src/",
"test/"
],
"exclude": [
"test/runtimes/bun",
"test/runtimes/browsers/node_modules",
"test/runtimes/cloudflare"
]
},
"lint": {
"include": ["mod.ts", "src/", "test/"],
"exclude": [
"test/runtimes/bun",
"test/runtimes/browsers/node_modules",
"test/runtimes/cloudflare"
]
},
"tasks": {
"test": "deno fmt && deno lint && deno test test -A --fail-fast --doc --coverage=coverage --parallel --allow-read",
"cov": "deno coverage ./coverage --lcov --exclude='test'",
"dnt": "deno run -A dnt.ts $(git describe --tags $(git rev-list --tags --max-count=1))",
"minify": "esbuild npm/esm/core/mod.js --bundle --format=esm --minify"
}
}
Loading

0 comments on commit 862bb8f

Please sign in to comment.