Skip to content

Commit

Permalink
feat: Add support for riscv64 architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
prantlf committed Aug 11, 2024
1 parent 2bdefb8 commit ccdd729
Show file tree
Hide file tree
Showing 17 changed files with 865 additions and 678 deletions.
10 changes: 0 additions & 10 deletions .denolint.json

This file was deleted.

84 changes: 32 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,55 @@ jobs:
changed: ${{ steps.bump.outputs.bumped }}
changed-files: ${{ steps.bump.outputs.changed-files }}
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- name: Install Node
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --no-verify-store-integrity
- name: Build
run: npm run build
- name: Test
run: npm test
- run: pnpm i --frozen-lockfile --no-verify-store-integrity
- run: npm run build
- run: npm test

macos:
runs-on: macos-latest
runs-on: macos-13
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- name: Install Node
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --no-verify-store-integrity
- name: Build
run: npm run build
- name: Test
run: |
- run: pnpm i --frozen-lockfile --no-verify-store-integrity
- run: npm run build
- run: |
npm run test-cover
./test.sh
- name: Coverage
uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

windows:
runs-on: windows-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- name: Install Node
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --no-verify-store-integrity
- name: Build
run: npm run build
- name: Test
run: npm test
- run: pnpm i --frozen-lockfile --no-verify-store-integrity
- run: npm run build
- run: npm test

release:
if: ${{ github.ref_name == 'master' }}
Expand All @@ -91,24 +77,18 @@ jobs:
- windows
runs-on: ubuntu-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- name: Install Node
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --no-verify-store-integrity
- name: Build
run: npm run build
- name: Publish Release
uses: prantlf/publish-release-action@v1
cache: 'pnpm'
- run: pnpm i --frozen-lockfile --no-verify-store-integrity
- run: npm run build
- uses: prantlf/publish-release-action@v1
with:
no-archives: true
env:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where:

* `{name}` is the name of the tool (executable)
* `{platform}` is the name of the target platform, by default: `linux`, `darwin` (also `macos`) and `win32` (also `windows`)
* `{architecture}` is the name of the target architecture, by default `arm64` (also `aarch64`) and `x64` (also `amd64`, `x86_64` or `x86`)
* `{architecture}` is the name of the target architecture, by default `arm64` (also `aarch64`), `riscv64` and `x64` (also `amd64`, `x86_64` or `x86`)

## Installation

Expand Down Expand Up @@ -103,6 +103,7 @@ interface GrabOptions {
platformSuffixes?: ArchiveSuffixes
// recognised architectures organised by the Node.js platform name; defaults:
// - arm64: aarch64, arm64
// - riscv64: riscv64
// - x64: amd64, x86_64, x64, x86
archSuffixes?: ArchiveSuffixes
// directory to write the archive or executable to; if not specified,
Expand Down
20 changes: 15 additions & 5 deletions bin/grab-github-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ function fail(message) {
}

const { argv } = process
let clearCache, repository, version, name, platformSuffixes, archSuffixes,
targetDirectory, unpackExecutable, cache, forceCache, token, verbose
let clearCache
let repository
let version
let name
let platformSuffixes
let archSuffixes
let targetDirectory
let unpackExecutable
let cache
let forceCache
let token
let verbose

for (let i = 2, l = argv.length; i < l; ++i) {
const arg = argv[i]
Expand Down Expand Up @@ -99,9 +109,9 @@ for (let i = 2, l = argv.length; i < l; ++i) {
return
case 'V': case 'version-spec':
{
const { readFile } = await import('fs/promises')
const { fileURLToPath } = await import('url')
const { join, dirname } = await import('path')
const { readFile } = await import('node:fs/promises')
const { fileURLToPath } = await import('node:url')
const { join, dirname } = await import('node:path')
const pkg = join(dirname(fileURLToPath(import.meta.url)), '../package.json')
console.log(JSON.parse(await readFile(pkg, 'utf8')).version)
process.exit(0)
Expand Down
49 changes: 49 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"ignore": ["dist/**"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noParameterAssign": "off"
},
"complexity": {
"useArrowFunction": "off"
}
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 90
},
"javascript": {
"formatter": {
"arrowParentheses": "asNeeded",
"bracketSpacing": true,
"quoteProperties": "asNeeded",
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingComma": "none"
}
},
"json": {
"parser": {
"allowComments": false,
"allowTrailingCommas": false
},
"formatter": {
"enabled": true,
"trailingCommas": "none"
}
}
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
],
"scripts": {
"build": "rollup -c && cp-j src/index.d.ts dist/",
"lint": "denolint && tsc --noEmit test/types.test.ts",
"lint": "biome lint *.js bin src test && tsc --noEmit test/types.test.ts",
"check": "node test/cjs.cjs && node test/mocked && node test/real",
"cover": "c8 node test/mocked",
"test": "tsc --noEmit test/types.test.ts && node test/cjs.cjs && node test/mocked && node test/real",
Expand All @@ -61,18 +61,18 @@
"statements": 100
},
"dependencies": {
"debug": "^4.3.4",
"semver": "^7.6.0",
"yauzl": "^3.1.2"
"debug": "^4.3.6",
"semver": "^7.6.3",
"yauzl": "^3.1.3"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@unixcompat/cp.js": "^3.0.0",
"c8": "^9.1.0",
"denolint": "2.0.14",
"c8": "^10.1.2",
"grab-github-release": "link:",
"rollup": "^4.13.2",
"rollup": "^4.20.0",
"rollup-plugin-cleanup": "^3.2.1",
"typescript": "^5.4.3"
"typescript": "^5.5.4"
},
"keywords": [
"github",
Expand Down
Loading

0 comments on commit ccdd729

Please sign in to comment.