Skip to content

Commit

Permalink
Replace yarn with pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt committed Nov 16, 2023
1 parent 06a82bd commit 833cb02
Show file tree
Hide file tree
Showing 5 changed files with 1,014 additions and 1,234 deletions.
67 changes: 30 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CI
on: [push, pull_request]

env:
YARN_GPG: no
npm_config_debug: yes
npm_config_build_from_source: true

Expand All @@ -18,63 +17,56 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: yarn
node-version: ${{ matrix.node-version }}

- name: Install pnpm
run: corepack enable && corepack prepare --activate pnpm@latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Run tests
run: yarn test

- name: "[Linux] Install lcov"
if: matrix.os == 'ubuntu-20.04'
run: sudo apt install lcov

- name: "[Linux] Generate coverage"
if: matrix.os == 'ubuntu-20.04'
run: |
cp -rl build/* build-tmp-napi-v3
rm -r build
yarn c8 report --reporter=text-lcov > lcov-js.info
lcov -c -d . --no-external -o lcov-cpp.info
lcov -r lcov-cpp.info "*/node_modules/*" -o lcov-cpp.info
lcov -a lcov-js.info -a lcov-cpp.info -o lcov.info
- name: "[Linux] Send to Codacy"
if: matrix.os == 'ubuntu-20.04'
uses: codacy/codacy-coverage-reporter-action@v1
with:
coverage-reports: lcov.info
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: pnpm test

test-alpine:
name: Test on Alpine Linux
strategy:
matrix:
node-version: [18, 20]

name: Test for node-${{ matrix.node-version }} on Alpine Linux
runs-on: ubuntu-latest
container:
image: node:18-alpine
image: node:${{ matrix.node-version }}-alpine

steps:
- name: Install build deps
run: apk add make g++ python3 git

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
run: corepack enable && corepack prepare --activate pnpm@latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Run tests
run: yarn test
run: pnpm test

test-freebsd:
strategy:
Expand All @@ -86,16 +78,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- uses: vmactions/freebsd-vm@v0
with:
envs: 'YARN_GPG npm_config_debug npm_config_build_from_source'
envs: 'npm_config_debug npm_config_build_from_source'
prepare: |
pkg install -y gmake python3 yarn-node${{ matrix.node-version }}
pkg install -y gmake python3 node${{ matrix.node-version }}
corepack enable && corepack prepare --activate pnpm@latest
run: |
yarn install --frozen-lockfile
yarn test
pnpm install --frozen-lockfile
pnpm test
sync: sshfs
71 changes: 43 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: yarn
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install pnpm
run: corepack enable && corepack prepare --activate pnpm@latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Publish to NPM
run: yarn publish
if: ${{ !env.ACT }}
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand All @@ -43,24 +45,27 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: yarn
node-version: 18

- name: Install pnpm
run: corepack enable && corepack prepare --activate pnpm@latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Package artifacts
run: yarn node-pre-gyp package
run: pnpm node-pre-gyp package

- name: Upload to Release
uses: csexton/release-asset-action@v2
if: ${{ !env.ACT }}
with:
pattern: build/stage/**/argon2*.tar.gz
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -77,18 +82,27 @@ jobs:
run: apk add make g++ python3 git

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
run: corepack enable && corepack prepare --activate pnpm@latest

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Package artifacts
run: yarn node-pre-gyp package
run: pnpm node-pre-gyp package

- name: Upload to Release
uses: csexton/release-asset-action@v2
if: ${{ !env.ACT }}
with:
pattern: build/stage/**/argon2*.tar.gz
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -107,7 +121,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -123,26 +137,25 @@ jobs:
npm_config_build_from_source: true
install: |
case "${{ matrix.distro }}" in
ubuntu*|jessie|stretch|buster)
apt-get update -y
apt-get install -y curl
ubuntu*)
apt update -q && apt install -yq curl make g++ python
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y make g++ python nodejs
npm install --global yarn
;;
alpine*)
apk add --update make g++ python3
apk add --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.17/main/ nodejs~=18 npm
npm install --global yarn
apk add --repository https://dl-cdn.alpinelinux.org/alpine/v3.17/main/ nodejs~=18 npm
;;
esac
corepack enable && corepack prepare --activate pnpm@latest
run: |
cd /repo
yarn install --frozen-lockfile
yarn node-pre-gyp package
pnpm install --frozen-lockfile
pnpm node-pre-gyp package
- name: Upload to Release
uses: csexton/release-asset-action@v2
if: ${{ !env.ACT }}
with:
pattern: build/stage/**/argon2*.tar.gz
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -154,7 +167,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -163,14 +176,16 @@ jobs:
with:
envs: 'npm_config_build_from_source'
prepare: |
pkg install -y gmake python3 yarn-node18
pkg install -y gmake python3 node18
corepack enable && corepack prepare pnpm@latest --activate
run: |
yarn install --frozen-lockfile
yarn node-pre-gyp package
pnpm install --frozen-lockfile
pnpm node-pre-gyp package
sync: sshfs

- name: Upload to Release
uses: csexton/release-asset-action@v2
if: ${{ !env.ACT }}
with:
pattern: build/stage/**/argon2*.tar.gz
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"scripts": {
"format": "prettier --write \"*.{js,json,ts}\"",
"install": "node-pre-gyp install --fallback-to-build",
"test": "c8 node --test test.mjs",
"test": "node --test",
"test:ts": "tsc -p ."
},
"dependencies": {
Expand All @@ -64,21 +64,16 @@
},
"devDependencies": {
"@types/node": "^20.8.10",
"c8": "^8.0.1",
"node-gyp": "^10.0.1",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"packageManager": "[email protected]+sha256.487609e857f1c11780cc98dd0bfe4c8a8b11c7f23bc3a4493ac7d263d6fb6c8c",
"engines": {
"node": ">=16.17.0"
"node": ">=18.13.0"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/node-argon2"
},
"standard": {
"ignore": [
"test-d.js"
]
}
}
Loading

0 comments on commit 833cb02

Please sign in to comment.