Skip to content
Draft
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
94 changes: 76 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- name: Lint
run: yarn lint

build-and-test:
name: 'Build and Test'
build:
name: 'Build'
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -59,37 +59,88 @@ jobs:
- name: Install deps
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Test browsers
run: yarn test:browser
- name: Store lib
uses: actions/upload-artifact@v4
with:
name: lib
path: lib/

- name: Switch to Node 16
test-browser:
name: 'Test - browser'
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Test Node 16
run: yarn test:nodejs
node-version-file: '.nvmrc'
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
env:
cache-name: cache-node_modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Install deps
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- name: Switch to Node 14
uses: actions/setup-node@v4
- name: Restore lib
uses: actions/download-artifact@v4
with:
node-version: '14'
- name: Test Node 14
run: yarn test:nodejs
name: lib
path: lib/

- name: Switch to Node 12
- name: Test
run: yarn test:browser

test-nodejs:
name: 'Test - Node.js'
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
version: ["16", "18", "20", "node"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '12'
- name: Test Node 12
run: yarn test:nodejs
node-version: ${{ matrix.version }}
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
env:
cache-name: cache-node_modules
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.version }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Install deps
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- name: Restore lib
uses: actions/download-artifact@v4
with:
name: lib
path: lib/

- name: Test
run: yarn test:nodejs

release:
name: Semantic release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [lint, build-and-test]
needs: [lint, build, test-browser, test-nodejs]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -115,6 +166,13 @@ jobs:
- name: Install deps
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- name: Restore lib
uses: actions/download-artifact@v4
with:
name: lib
path: lib/

- name: Release
run: yarn release
env:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
20
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"LICENSE"
],
"scripts": {
"prepublishOnly": "yarn build",
"build": "yarn build:node && yarn build:browser",
"build:node": "tsc",
"build:browser": "browserify --standalone MatrixEncryptAttachment -d src/webcrypto.ts -p [ tsify -p ./tsconfig.json ] | exorcist lib/browser-encrypt-attachment.js.map > lib/browser-encrypt-attachment.js",
Expand Down Expand Up @@ -60,6 +59,6 @@
"typescript": "^4.4.4"
},
"engines": {
"node": ">=12.0"
"node": ">=16.0"
}
}