From d61c30075036bf82fd81fdf6445bc5309d8af721 Mon Sep 17 00:00:00 2001 From: balenaCI Date: Tue, 16 May 2023 00:02:37 +0000 Subject: [PATCH] build linux/arm packages change-type: minor --- .github/actions/publish/action.yml | 5 +- .github/actions/test/action.yml | 5 +- .github/workflows/flowzone.yml | 21 ++++- automation/build-bin.ts | 15 +++- npm-shrinkwrap.json | 84 ++++++++--------- ...n.txt => expected-warnings-darwin-x64.txt} | 0 .../pkg/expected-warnings-linux-arm64.txt | 90 +++++++++++++++++++ ...ux.txt => expected-warnings-linux-x64.txt} | 0 ...32.txt => expected-warnings-win32-x64.txt} | 0 9 files changed, 169 insertions(+), 51 deletions(-) rename tests/test-data/pkg/{expected-warnings-darwin.txt => expected-warnings-darwin-x64.txt} (100%) create mode 100644 tests/test-data/pkg/expected-warnings-linux-arm64.txt rename tests/test-data/pkg/{expected-warnings-linux.txt => expected-warnings-linux-x64.txt} (100%) rename tests/test-data/pkg/{expected-warnings-win32.txt => expected-warnings-win32-x64.txt} (100%) diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml index 002fb288..2bf52e38 100644 --- a/.github/actions/publish/action.yml +++ b/.github/actions/publish/action.yml @@ -8,6 +8,9 @@ inputs: secrets: description: "JSON stringified object containing all the secrets from the calling workflow" required: true + variables: + description: "JSON stringified object containing all the variables from the calling workflow" + required: true # --- custom environment XCODE_APP_LOADER_EMAIL: @@ -27,7 +30,7 @@ runs: - name: Download custom source artifact uses: actions/download-artifact@v3 with: - name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }} + name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}-${{ runner.arch }} path: ${{ runner.temp }} - name: Extract custom source artifact diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 3db715e5..109f8f67 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -8,6 +8,9 @@ inputs: secrets: description: "JSON stringified object containing all the secrets from the calling workflow" required: true + variables: + description: "JSON stringified object containing all the variables from the calling workflow" + required: true # --- custom environment NODE_VERSION: @@ -51,6 +54,6 @@ runs: - name: Upload custom artifact uses: actions/upload-artifact@v3 with: - name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }} + name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}-${{ runner.arch }} path: ${{ runner.temp }}/custom.tgz retention-days: 1 diff --git a/.github/workflows/flowzone.yml b/.github/workflows/flowzone.yml index 344035bf..cb7c2178 100644 --- a/.github/workflows/flowzone.yml +++ b/.github/workflows/flowzone.yml @@ -3,14 +3,27 @@ name: Flowzone on: pull_request: types: [opened, synchronize, closed] - branches: - - "main" - - "master" + branches: [main, master] + pull_request_target: + types: [opened, synchronize, closed] + branches: [main, master] jobs: flowzone: name: Flowzone uses: product-os/flowzone/.github/workflows/flowzone.yml@v4.7.1 + # prevent duplicate workflow executions for pull_request and pull_request_target + if: | + ( + github.event.pull_request.head.repo.full_name == github.repository && + github.event_name == 'pull_request' + ) || ( + github.event.pull_request.head.repo.full_name != github.repository && + github.event_name == 'pull_request_target' + ) secrets: inherit with: - tests_run_on: '["ubuntu-20.04","macos-11","windows-2019"]' + custom_runs_on: '[["self-hosted","Linux","distro:focal","X64"],["self-hosted","Linux","distro:focal","ARM64"],["macos-11"],["windows-2019"]]' + repo_config: true + repo_description: "The official balena CLI tool." + github_prerelease: true diff --git a/automation/build-bin.ts b/automation/build-bin.ts index 245d5a13..217bfefd 100644 --- a/automation/build-bin.ts +++ b/automation/build-bin.ts @@ -87,7 +87,7 @@ async function diffPkgOutput(pkgOut: string) { 'tests', 'test-data', 'pkg', - `expected-warnings-${process.platform}.txt`, + `expected-warnings-${process.platform}-${arch}.txt`, ); const absSavedPath = path.join(ROOT, relSavedPath); const ignoreStartsWith = [ @@ -180,9 +180,18 @@ async function execPkg(...args: any[]) { * to be directly executed from inside another binary executable.) */ async function buildPkg() { + // https://github.com/vercel/pkg#targets + let targets = `linux-${arch}`; + // TBC: not possible to build for macOS or Windows arm64 on x64 nodes + if (process.platform === 'darwin') { + targets = `macos-x64`; + } + if (process.platform === 'win32') { + targets = `win-x64`; + } const args = [ - '--target', - 'host', + '--targets', + targets, '--output', 'build-bin/balena', 'package.json', diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index e99bda23..35a3237c 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1790,16 +1790,16 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@oclif/command": { - "version": "1.8.24", - "resolved": "https://registry.npmjs.org/@oclif/command/-/command-1.8.24.tgz", - "integrity": "sha512-FbSChfBO2QFeC5eEeXmi8+kZvBCDzYdpEKhOMaz0sfKMerwSlKxsqWQPGWCjTHaowIUMtnMD3VZ8yfX5qE7SAQ==", + "version": "1.8.25", + "resolved": "https://registry.npmjs.org/@oclif/command/-/command-1.8.25.tgz", + "integrity": "sha512-teCfKH6GNF46fiCn/P5EMHX93RE3KJAW4i0sq3X9phrzs6807WRauhythdc8OKINxd+LpqwQ1i5bnaCKvLZRcQ==", "dependencies": { "@oclif/config": "^1.18.2", "@oclif/errors": "^1.3.6", "@oclif/help": "^1.0.1", "@oclif/parser": "^3.8.10", "debug": "^4.1.1", - "semver": "^7.5.0" + "semver": "^7.5.1" }, "engines": { "node": ">=12.0.0" @@ -3048,9 +3048,9 @@ } }, "node_modules/@types/node": { - "version": "16.18.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.29.tgz", - "integrity": "sha512-cal+XTYF4JBwG82kw3m9ktTOyUj7GXcO9i2o+t49y/OF+3asYfpHqTROF1UbV91e71g/UB5wNeL5hfqPthzp8Q==" + "version": "16.18.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.30.tgz", + "integrity": "sha512-Kmp/wBZk19Dn7uRiol8kF8agnf8m0+TU9qIwyfPmXglVxMlmiIz0VQSMw5oFgwhmD2aKTlfBIO5FtsVj3y7hKQ==" }, "node_modules/@types/node-cleanup": { "version": "2.1.2", @@ -3788,9 +3788,9 @@ } }, "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dependencies": { "safer-buffer": "~2.1.0" } @@ -10983,9 +10983,9 @@ } }, "node_modules/is-core-module": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", - "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", "dependencies": { "has": "^1.0.3" }, @@ -17439,9 +17439,9 @@ } }, "node_modules/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -18237,19 +18237,19 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "node_modules/ssh2": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.12.0.tgz", - "integrity": "sha512-7mcLu8biO6/BjQQ1iCjCmuBiF0hXxo+JlHpJBPDTVsxU7evscWWiRUgYF5XIs4gLKmiPRHA0maund11QLWyDJg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.13.0.tgz", + "integrity": "sha512-CIZBFRRY1y9mAZSqBGFE4EB4dNJad2ysT2PqO8OpkiI3UTB/gUZwE5EaN16qVyQ6s/M7EgC/iaV/MnjdlvnuzA==", "hasInstallScript": true, "dependencies": { - "asn1": "^0.2.4", + "asn1": "^0.2.6", "bcrypt-pbkdf": "^1.0.2" }, "engines": { "node": ">=10.16.0" }, "optionalDependencies": { - "cpu-features": "~0.0.6", + "cpu-features": "~0.0.7", "nan": "^2.17.0" } }, @@ -23789,16 +23789,16 @@ } }, "@oclif/command": { - "version": "1.8.24", - "resolved": "https://registry.npmjs.org/@oclif/command/-/command-1.8.24.tgz", - "integrity": "sha512-FbSChfBO2QFeC5eEeXmi8+kZvBCDzYdpEKhOMaz0sfKMerwSlKxsqWQPGWCjTHaowIUMtnMD3VZ8yfX5qE7SAQ==", + "version": "1.8.25", + "resolved": "https://registry.npmjs.org/@oclif/command/-/command-1.8.25.tgz", + "integrity": "sha512-teCfKH6GNF46fiCn/P5EMHX93RE3KJAW4i0sq3X9phrzs6807WRauhythdc8OKINxd+LpqwQ1i5bnaCKvLZRcQ==", "requires": { "@oclif/config": "^1.18.2", "@oclif/errors": "^1.3.6", "@oclif/help": "^1.0.1", "@oclif/parser": "^3.8.10", "debug": "^4.1.1", - "semver": "^7.5.0" + "semver": "^7.5.1" } }, "@oclif/config": { @@ -24890,9 +24890,9 @@ } }, "@types/node": { - "version": "16.18.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.29.tgz", - "integrity": "sha512-cal+XTYF4JBwG82kw3m9ktTOyUj7GXcO9i2o+t49y/OF+3asYfpHqTROF1UbV91e71g/UB5wNeL5hfqPthzp8Q==" + "version": "16.18.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.30.tgz", + "integrity": "sha512-Kmp/wBZk19Dn7uRiol8kF8agnf8m0+TU9qIwyfPmXglVxMlmiIz0VQSMw5oFgwhmD2aKTlfBIO5FtsVj3y7hKQ==" }, "@types/node-cleanup": { "version": "2.1.2", @@ -25528,9 +25528,9 @@ "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==" }, "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "requires": { "safer-buffer": "~2.1.0" } @@ -31217,9 +31217,9 @@ } }, "is-core-module": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", - "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", "requires": { "has": "^1.0.3" } @@ -36283,9 +36283,9 @@ } }, "semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", "requires": { "lru-cache": "^6.0.0" } @@ -36928,13 +36928,13 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "ssh2": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.12.0.tgz", - "integrity": "sha512-7mcLu8biO6/BjQQ1iCjCmuBiF0hXxo+JlHpJBPDTVsxU7evscWWiRUgYF5XIs4gLKmiPRHA0maund11QLWyDJg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.13.0.tgz", + "integrity": "sha512-CIZBFRRY1y9mAZSqBGFE4EB4dNJad2ysT2PqO8OpkiI3UTB/gUZwE5EaN16qVyQ6s/M7EgC/iaV/MnjdlvnuzA==", "requires": { - "asn1": "^0.2.4", + "asn1": "^0.2.6", "bcrypt-pbkdf": "^1.0.2", - "cpu-features": "~0.0.6", + "cpu-features": "~0.0.7", "nan": "^2.17.0" } }, diff --git a/tests/test-data/pkg/expected-warnings-darwin.txt b/tests/test-data/pkg/expected-warnings-darwin-x64.txt similarity index 100% rename from tests/test-data/pkg/expected-warnings-darwin.txt rename to tests/test-data/pkg/expected-warnings-darwin-x64.txt diff --git a/tests/test-data/pkg/expected-warnings-linux-arm64.txt b/tests/test-data/pkg/expected-warnings-linux-arm64.txt new file mode 100644 index 00000000..0cbe60ab --- /dev/null +++ b/tests/test-data/pkg/expected-warnings-linux-arm64.txt @@ -0,0 +1,90 @@ +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/open/xdg-open + %2: path-to-executable/xdg-open +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/open/xdg-open + %2: path-to-executable/xdg-open +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/build/Release/drivelist.node + %2: path-to-executable/drivelist.node +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/scripts/darwin.sh + %2: path-to-executable/drivelist/darwin.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/scripts/linux.sh + %2: path-to-executable/drivelist/linux.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/scripts/win32.bat + %2: path-to-executable/drivelist/win32.bat +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/build/Release/drivelist.node + %2: path-to-executable/drivelist.node +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/scripts/darwin.sh + %2: path-to-executable/drivelist/darwin.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/scripts/linux.sh + %2: path-to-executable/drivelist/linux.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/etcher-sdk/node_modules/drivelist/scripts/win32.bat + %2: path-to-executable/drivelist/win32.bat +> Warning Cannot resolve 'path' + node_modules/@balena/compose/dist/parse/schemas/index.js + Dynamic require may fail at run time, because the requested file + is unknown at compilation time and not included into executable. + Use a string literal as an argument for 'require', or leave it + as is and specify the resolved file name in 'scripts' option. +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/build/Release/drivelist.node + %2: path-to-executable/drivelist.node +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/scripts/darwin.sh + %2: path-to-executable/drivelist/darwin.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/scripts/linux.sh + %2: path-to-executable/drivelist/linux.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/scripts/win32.bat + %2: path-to-executable/drivelist/win32.bat +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/build/Release/drivelist.node + %2: path-to-executable/drivelist.node +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/scripts/darwin.sh + %2: path-to-executable/drivelist/darwin.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/scripts/linux.sh + %2: path-to-executable/drivelist/linux.sh +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/drivelist/scripts/win32.bat + %2: path-to-executable/drivelist/win32.bat +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/opn/xdg-open + %2: path-to-executable/xdg-open +> Warning Cannot include file %1 into executable. + The file must be distributed with executable as %2. + %1: node_modules/opn/xdg-open + %2: path-to-executable/xdg-open +prebuild-install warn install No prebuilt binaries found (target=v16.16.0 runtime=node arch=arm64 libc= platform=linux) +prebuild-install warn install No prebuilt binaries found (target=v16.16.0 runtime=node arch=arm64 libc= platform=linux) +prebuild-install warn install No prebuilt binaries found (target=v16.16.0 runtime=node arch=arm64 libc= platform=linux) +prebuild-install warn install No prebuilt binaries found (target=v16.16.0 runtime=node arch=arm64 libc= platform=linux) diff --git a/tests/test-data/pkg/expected-warnings-linux.txt b/tests/test-data/pkg/expected-warnings-linux-x64.txt similarity index 100% rename from tests/test-data/pkg/expected-warnings-linux.txt rename to tests/test-data/pkg/expected-warnings-linux-x64.txt diff --git a/tests/test-data/pkg/expected-warnings-win32.txt b/tests/test-data/pkg/expected-warnings-win32-x64.txt similarity index 100% rename from tests/test-data/pkg/expected-warnings-win32.txt rename to tests/test-data/pkg/expected-warnings-win32-x64.txt