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

ci: remove docker from build pipeline #9

Merged
merged 1 commit into from
Dec 6, 2023
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
3 changes: 1 addition & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ plugins:

extends:
- eslint:recommended
- plugin:prettier/recommended

- prettier
rules:
# 0 = off, 1 = warn, 2 = error
'space-before-function-paren': 0
Expand Down
65 changes: 19 additions & 46 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ jobs:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: |
yarn build
strip -x *.node
build: yarn build
- host: windows-latest
build: yarn build
target: x86_64-pc-windows-msvc
Expand All @@ -44,14 +42,10 @@ jobs:
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |-
set -e &&
yarn build --target x86_64-unknown-linux-gnu &&
strip *.node
build: CC=clang yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: set -e && yarn build && strip *.node
build: yarn build --target x86_64-unknown-linux-musl -x
- host: macos-latest
target: aarch64-apple-darwin
build: |
Expand All @@ -61,40 +55,21 @@ jobs:
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
yarn build --target aarch64-apple-darwin
strip -x *.node
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |-
set -e &&
yarn build --target aarch64-unknown-linux-gnu &&
aarch64-unknown-linux-gnu-strip *.node
build: CC=clang yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
setup: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf -y
build: |
yarn build --target armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip *.node
build: CC=clang yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross
- host: ubuntu-latest
target: aarch64-linux-android
build: |
yarn build --target aarch64-linux-android
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
build: yarn build --target aarch64-linux-android
- host: ubuntu-latest
target: armv7-linux-androideabi
build: |
yarn build --target armv7-linux-androideabi
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
build: yarn build --target armv7-linux-androideabi
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
set -e &&
rustup target add aarch64-unknown-linux-musl &&
yarn build --target aarch64-unknown-linux-musl &&
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
build: yarn build --target aarch64-unknown-linux-musl -x
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
Expand All @@ -108,9 +83,16 @@ jobs:
with:
node-version: 18
cache: yarn
- name: Download tar.node
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
run: |
npm pack @napi-rs/tar-linux-x64-gnu@latest
tar -xzf napi-rs-tar-*.tgz
mv package/tar.linux-x64-gnu.node .
rm napi-rs-tar-*.tgz
rm -rf package
- name: Install
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
Expand All @@ -121,11 +103,11 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache
~/.napi-rs
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.11.0
- name: Setup toolchain
Expand All @@ -143,18 +125,9 @@ jobs:
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 18
cache: yarn
architecture: x86
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
run: ${{ matrix.settings.build }}
- name: Build
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -411,7 +384,7 @@ jobs:
- name: Setup and run tests
uses: addnab/docker-run-action@v3
with:
image: node:${{ matrix.node }}-bullseye-slim
image: node:${{ matrix.node }}-slim
options: '--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build'
run: |
set -e
Expand Down
219 changes: 111 additions & 108 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,83 @@
/* tslint:disable */
/* eslint-disable */

/* auto-generated by NAPI-RS */
/* eslint-disable */

/**
* Indicate for the type of file described by a header.
*
* Each `Header` has an `entry_type` method returning an instance of this type
* which can be used to inspect what the header is describing.
* A non-exhaustive enum representing the possible entry types
*/
export const enum EntryType {
/** Regular file */
Regular = 0,
/** Hard link */
Link = 1,
/** Symbolic link */
Symlink = 2,
/** Character device */
Char = 3,
/** Block device */
Block = 4,
/** Directory */
Directory = 5,
/** Named pipe (fifo) */
Fifo = 6,
/** Implementation-defined 'high-performance' type, treated as regular file */
Continuous = 7,
/** GNU extension - long file name */
GNULongName = 8,
/** GNU extension - long link name (link target) */
GNULongLink = 9,
/** GNU extension - sparse file */
GNUSparse = 10,
/** Global extended header */
XGlobalHeader = 11,
/** Extended Header */
XHeader = 12,
export class Archive {
/** Create a new archive with the underlying path. */
constructor(input: string | Buffer)
entries(): Entries
/**
* Unpacks the contents tarball into the specified `dst`.
*
* This function will iterate over the entire contents of this tarball,
* extracting each file in turn to the location specified by the entry's
* path name.
*
* This operation is relatively sensitive in that it will not write files
* outside of the path specified by `dst`. Files in the archive which have
* a '..' in their path are skipped during the unpacking process.
*/
unpack(to: string): void
/**
* Set the mask of the permission bits when unpacking this entry.
*
* The mask will be inverted when applying against a mode, similar to how
* `umask` works on Unix. In logical notation it looks like:
*
* ```text
* new_mode = old_mode & (~mask)
* ```
*
* The mask is 0 by default and is currently only implemented on Unix.
*/
setMask(mask: number): void
/**
* Indicate whether extended file attributes (xattrs on Unix) are preserved
* when unpacking this archive.
*
* This flag is disabled by default and is currently only implemented on
* Unix using xattr support. This may eventually be implemented for
* Windows, however, if other archive implementations are found which do
* this as well.
*/
setUnpackXattrs(unpackXattrs: boolean): void
/**
* Indicate whether extended permissions (like suid on Unix) are preserved
* when unpacking this entry.
*
* This flag is disabled by default and is currently only implemented on
* Unix.
*/
setPreservePermissions(preservePermissions: boolean): void
/**
* Indicate whether numeric ownership ids (like uid and gid on Unix)
* are preserved when unpacking this entry.
*
* This flag is disabled by default and is currently only implemented on
* Unix.
*/
setPreserveOwnerships(preserveOwnerships: boolean): void
/** Indicate whether files and symlinks should be overwritten on extraction. */
setOverwrite(overwrite: boolean): void
/**
* Indicate whether access time information is preserved when unpacking
* this entry.
*
* This flag is enabled by default.
*/
setPreserveMtime(preserveMtime: boolean): void
/**
* Ignore zeroed headers, which would otherwise indicate to the archive that it has no more
* entries.
*
* This can be used in case multiple tar archives have been concatenated together.
*/
setIgnoreZeros(ignoreZeros: boolean): void
}

export class Entries {
[Symbol.iterator](): Iterator<Entry, void, void>
}

export class Entry {
/**
* Returns the path name for this entry.
Expand All @@ -59,6 +96,7 @@ export class Entry {
path(): string | null
header(): ReadonlyHeader
}

export class Header {
/** Returns a view into this header as a byte array. */
asBytes(): Buffer
Expand Down Expand Up @@ -244,6 +282,7 @@ export class Header {
*/
setCksum(): void
}

export class ReadonlyHeader {
/** Returns a view into this header as a byte array. */
asBytes(): Buffer
Expand Down Expand Up @@ -347,75 +386,39 @@ export class ReadonlyHeader {
*/
cksum(): number
}
export class Archive {
/** Create a new archive with the underlying path. */
constructor(input: string | Buffer)
entries(): Entries
/**
* Unpacks the contents tarball into the specified `dst`.
*
* This function will iterate over the entire contents of this tarball,
* extracting each file in turn to the location specified by the entry's
* path name.
*
* This operation is relatively sensitive in that it will not write files
* outside of the path specified by `dst`. Files in the archive which have
* a '..' in their path are skipped during the unpacking process.
*/
unpack(to: string): void
/**
* Set the mask of the permission bits when unpacking this entry.
*
* The mask will be inverted when applying against a mode, similar to how
* `umask` works on Unix. In logical notation it looks like:
*
* ```text
* new_mode = old_mode & (~mask)
* ```
*
* The mask is 0 by default and is currently only implemented on Unix.
*/
setMask(mask: number): void
/**
* Indicate whether extended file attributes (xattrs on Unix) are preserved
* when unpacking this archive.
*
* This flag is disabled by default and is currently only implemented on
* Unix using xattr support. This may eventually be implemented for
* Windows, however, if other archive implementations are found which do
* this as well.
*/
setUnpackXattrs(unpackXattrs: boolean): void
/**
* Indicate whether extended permissions (like suid on Unix) are preserved
* when unpacking this entry.
*
* This flag is disabled by default and is currently only implemented on
* Unix.
*/
setPreservePermissions(preservePermissions: boolean): void
/**
* Indicate whether numeric ownership ids (like uid and gid on Unix)
* are preserved when unpacking this entry.
*
* This flag is disabled by default and is currently only implemented on
* Unix.
*/
setPreserveOwnerships(preserveOwnerships: boolean): void
/** Indicate whether files and symlinks should be overwritten on extraction. */
setOverwrite(overwrite: boolean): void
/**
* Indicate whether access time information is preserved when unpacking
* this entry.
*
* This flag is enabled by default.
*/
setPreserveMtime(preserveMtime: boolean): void
/**
* Ignore zeroed headers, which would otherwise indicate to the archive that it has no more
* entries.
*
* This can be used in case multiple tar archives have been concatenated together.
*/
setIgnoreZeros(ignoreZeros: boolean): void

/**
* Indicate for the type of file described by a header.
*
* Each `Header` has an `entry_type` method returning an instance of this type
* which can be used to inspect what the header is describing.
* A non-exhaustive enum representing the possible entry types
*/
export const enum EntryType {
/** Regular file */
Regular = 0,
/** Hard link */
Link = 1,
/** Symbolic link */
Symlink = 2,
/** Character device */
Char = 3,
/** Block device */
Block = 4,
/** Directory */
Directory = 5,
/** Named pipe (fifo) */
Fifo = 6,
/** Implementation-defined 'high-performance' type, treated as regular file */
Continuous = 7,
/** GNU extension - long file name */
GNULongName = 8,
/** GNU extension - long link name (link target) */
GNULongLink = 9,
/** GNU extension - sparse file */
GNUSparse = 10,
/** Global extended header */
XGlobalHeader = 11,
/** Extended Header */
XHeader = 12,
}
Loading