@automattic/yara 2.5.0 → 2.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,10 @@ on:
7
7
  branches: [ master ]
8
8
  pull_request:
9
9
 
10
+ # we're going to build and commit fresh binaries when a new release is published
11
+ release:
12
+ types: [created]
13
+
10
14
  # allow these jobs to commit to the repository
11
15
  permissions:
12
16
  contents: write
@@ -19,27 +23,41 @@ jobs:
19
23
  fail-fast: false
20
24
  matrix:
21
25
  node-version:
22
- # - '14'
23
26
  - '16'
24
- # - '18'
27
+ - '18'
28
+ - '20'
25
29
 
26
30
  runs-on: ubuntu-22.04
27
31
 
28
32
  steps:
29
33
  - uses: actions/checkout@v3
30
34
 
35
+ # https://github.com/actions/setup-node
36
+ - name: Install Node.js ${{ matrix.node-version }}
37
+ uses: actions/setup-node@master
38
+ with:
39
+ node-version: ${{ matrix.node-version }}
40
+
31
41
  - name: Build binaries inside the container
32
42
  run: |
33
43
  set -x
34
-
44
+ node -v
45
+
35
46
  # what's the package version?
36
47
  # e.g. Binary staged at "build/stage/Automattic/node-yara/raw/master/binaries/yara-v2.5.0-linux-x64.tar.gz"
37
48
  export PACKAGE_VERSION=$(jq -r .version package.json)
38
49
 
39
- # build inside the container and copy the package to the host
40
- docker build -t yara/debian .
50
+ # what's the Node.js version?
51
+ export ABI=$(node --eval 'console.log(process.versions.modules)')
52
+
53
+ echo "::notice::Building binary for node-yara package v${PACKAGE_VERSION} for Node.js $(node -v) (ABI ${ABI}) ..."
54
+
55
+ # build inside the container (pass the required Node.js version there) and copy the package to the host
56
+ docker build --build-arg NODEJS=${{ matrix.node-version }} -t yara/debian .
41
57
  docker images
42
- docker run --rm --volume /tmp:/tmp yara/debian cp ./binaries/yara-v${PACKAGE_VERSION}-linux-x64.tar.gz /tmp
58
+
59
+ # e.g. yara-v2.5.0-linux-x64-node-v93.tar.gz
60
+ docker run --rm --volume /tmp:/tmp yara/debian cp ./binaries/yara-v${PACKAGE_VERSION}-linux-x64-node-v${ABI}.tar.gz /tmp
43
61
  ls -lh /tmp/yara-v${PACKAGE_VERSION}-*
44
62
 
45
63
  # copy it to the repository clone and see if there's a difference
@@ -50,7 +68,8 @@ jobs:
50
68
  # and co-authored by the user that made the last commit.
51
69
  # https://github.com/marketplace/actions/git-auto-commit
52
70
  - name: Commit the changes to the binary files
53
- if: false # node-gyp builds are not reproducible, hence each build would create a "new" commit -> disabling for now (comment out this line if needed)
71
+ # if: true # node-gyp builds are not reproducible, hence each build would create a "new" commit -> disabling for now (comment out this line if needed)
72
+ if: github.event_name == 'release' && github.event.action == 'created' # commit new binaries package on releases
54
73
  uses: stefanzweifel/git-auto-commit-action@v4
55
74
  with:
56
75
  ref: ${{ github.head_ref }} # https://github.com/marketplace/actions/git-auto-commit#checkout-the-correct-branch
@@ -63,9 +82,9 @@ jobs:
63
82
  fail-fast: false
64
83
  matrix:
65
84
  node-version:
66
- # - '14'
67
85
  - '16'
68
- # - '18'
86
+ - '18'
87
+ - '20'
69
88
 
70
89
  runs-on: macos-12
71
90
 
@@ -83,6 +102,15 @@ jobs:
83
102
  - name: Build binaries with node-pre-gyp
84
103
  run: |
85
104
  set -x
105
+
106
+ # what's the package version?
107
+ # e.g. Binary staged at "build/stage/Automattic/node-yara/raw/master/binaries/yara-v2.5.0-linux-x64.tar.gz"
108
+ export PACKAGE_VERSION=$(jq -r .version package.json)
109
+
110
+ # what's the Node.js version?
111
+ export ABI=$(node --eval 'console.log(process.versions.modules)')
112
+ echo "::notice::Building binary for node-yara package v${PACKAGE_VERSION} for Node.js $(node -v) (ABI ${ABI}) ..."
113
+
86
114
  npm install --ignore-scripts
87
115
  time -p npx node-pre-gyp configure rebuild
88
116
 
@@ -96,11 +124,14 @@ jobs:
96
124
  - name: Run tests
97
125
  run: npm test
98
126
 
127
+ # TODO: publish as the release artifacts
128
+ #
99
129
  # By default, the commit is made in the name of "GitHub Actions"
100
130
  # and co-authored by the user that made the last commit.
101
131
  # https://github.com/marketplace/actions/git-auto-commit
102
132
  - name: Commit the changes to the binary files
103
- if: false # node-gyp builds are not reproducible, hence each build would create a "new" commit -> disabling for now (comment out this line if needed)
133
+ # if: true # node-gyp builds are not reproducible, hence each build would create a "new" commit -> disabling for now (comment out this line if needed)
134
+ if: github.event_name == 'release' && github.event.action == 'created' # commit new binaries package on releases
104
135
  uses: stefanzweifel/git-auto-commit-action@v4
105
136
  with:
106
137
  ref: ${{ github.head_ref }} # https://github.com/marketplace/actions/git-auto-commit#checkout-the-correct-branch
package/Dockerfile CHANGED
@@ -1,5 +1,6 @@
1
1
  # this container is used to build binaries for Debian 10 (aka oldstable)
2
- FROM node:16.16-buster-slim
2
+ ARG NODEJS=16.16
3
+ FROM node:$NODEJS-buster-slim
3
4
 
4
5
  RUN apt-get update -y && \
5
6
  apt-get install -y \
package/binding.gyp CHANGED
@@ -4,10 +4,13 @@
4
4
  "target_name": "action_before_build",
5
5
  "type": "none",
6
6
  "copies": [],
7
+ "variables": {
8
+ 'architecture': '<!(uname -m)'
9
+ },
7
10
  "conditions": [
8
11
  ['OS == "linux"', {
9
12
  "copies": [{
10
- "files": [ "/usr/lib/x86_64-linux-gnu/libmagic.a" ],
13
+ "files": [ "/usr/lib/<(architecture)-linux-gnu/libmagic.a" ],
11
14
  "destination": "build/"
12
15
  }],
13
16
  }],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@automattic/yara",
3
- "version": "2.5.0",
4
- "description": "Automattic's fork of YARA support for Node.js",
3
+ "version": "2.6.0-beta.1",
4
+ "description": "Automattic's fork of YARA support for Node.js with pre-built binaries",
5
5
  "main": "index.js",
6
6
  "directories": {
7
7
  "example": "example"
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@mapbox/node-pre-gyp": "^1.0.10",
11
11
  "nan": "2.17.*",
12
- "typescript": "^4.9.5"
12
+ "typescript": "^5.1.3"
13
13
  },
14
14
  "scripts": {
15
15
  "test": "mocha test/*",
@@ -20,7 +20,7 @@
20
20
  "module_path": "./build/Release",
21
21
  "host": "https://github.com/",
22
22
  "remote_path": "/Automattic/node-yara/raw/master/binaries/",
23
- "package_name": "{module_name}-v{version}-{platform}-{arch}.tar.gz"
23
+ "package_name": "{module_name}-v{version}-{platform}-{arch}-{node_abi}.tar.gz"
24
24
  },
25
25
  "contributors": [
26
26
  {