diff --git a/.circleci/config.yml b/.circleci/config.yml index b2ef64cc45..fc1a52dda8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,16 +86,11 @@ executors: - image: ubuntu:focal working_directory: /mnt/ramdisk/snyk resource_class: arm.medium - macos-amd64: - macos: - # https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions - xcode: '14.3.1' - resource_class: macos.x86.medium.gen2 macos-arm64: macos: # https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions xcode: '14.3.1' - resource_class: macos.m1.large.gen1 + resource_class: macos.m1.medium.gen1 win-server2022-amd64: machine: image: windows-server-2022-gui:2023.07.1 @@ -279,6 +274,9 @@ commands: type: string default: go gradle python elixir composer gradle@6 maven sbt dotnet steps: + - run: + name: Installing Rosetta + command: softwareupdate --install-rosetta --agree-to-license - restore_cache: key: acceptance-tests-macos-<< parameters.items >> - run: @@ -298,6 +296,9 @@ commands: type: string default: go gradle python elixir composer gradle@6 maven sbt dotnet steps: + - run: + name: Installing Rosetta + command: softwareupdate --install-rosetta --agree-to-license - install-deps-python: os: macos @@ -409,7 +410,18 @@ workflows: go_os: darwin go_arch: amd64 go_download_base_url: << pipeline.parameters.go_download_base_url >> - executor: macos-amd64 + executor: macos-arm64 + install_deps_extension: macos-build + requires: + - prepare-build + + - build-artifact: + name: build macOS arm64 + go_target_os: darwin + go_os: darwin + go_arch: arm64 + go_download_base_url: << pipeline.parameters.go_download_base_url >> + executor: macos-arm64 install_deps_extension: macos-build requires: - prepare-build @@ -502,9 +514,9 @@ workflows: branches: ignore: master requires: - - build macOS amd64 - executor: macos-amd64 - test_snyk_command: ./binary-releases/snyk-macos + - build macOS arm64 + executor: macos-arm64 + test_snyk_command: ./binary-releases/snyk-macos-arm64 install_deps_extension: macos-full - acceptance-tests: @@ -546,7 +558,22 @@ workflows: - build macOS amd64 go_os: darwin go_arch: amd64 - executor: macos-amd64 + executor: macos-arm64 + install_deps_extension: noop + filters: + branches: + only: + - master + - '/.*e2e.*/' + + - sign: + name: sign macos arm64 + context: snyk-macos-signing + requires: + - build macOS arm64 + go_os: darwin + go_arch: arm64 + executor: macos-arm64 install_deps_extension: noop filters: branches: @@ -559,6 +586,7 @@ workflows: context: snyk-cli-pgp-signing requires: - sign macos amd64 + - sign macos arm64 - sign windows amd64 - build alpine amd64 - build linux amd64 @@ -600,7 +628,7 @@ workflows: executor: - 'docker-amd64' - 'win-server2019-amd64' - - 'macos-amd64' + - 'macos-arm64' requires: - upload version filters: @@ -619,7 +647,7 @@ workflows: - 'docker-arm64' - 'win-server2019-amd64' - 'win-server2022-amd64' - - 'macos-amd64' + - 'macos-arm64' - 'linux-ubuntu-latest-amd64' - 'linux-ubuntu-mantic-amd64' - 'linux-ubuntu-jammy-amd64' @@ -673,12 +701,12 @@ workflows: requires: - Validate NPM artifacts (docker-amd64) - Validate NPM artifacts (win-server2019-amd64) - - Validate NPM artifacts (macos-amd64) + - Validate NPM artifacts (macos-arm64) - e2e tests (docker-amd64) - e2e tests (docker-arm64) - e2e tests (win-server2019-amd64) - e2e tests (win-server2022-amd64) - - e2e tests (macos-amd64) + - e2e tests (macos-arm64) - e2e tests (linux-ubuntu-latest-amd64) - e2e tests (linux-ubuntu-mantic-amd64) - e2e tests (linux-ubuntu-jammy-amd64) diff --git a/Makefile b/Makefile index 6e23021a1f..b066632b77 100644 --- a/Makefile +++ b/Makefile @@ -135,6 +135,10 @@ $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-macos: prepack | $(BINARY_RELEASES_FOLDER_ $(PKG) -t node$(PKG_NODE_VERSION)-macos-x64 -o $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-macos $(MAKE) $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-macos.sha256 +$(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-macos-arm64: prepack | $(BINARY_RELEASES_FOLDER_TS_CLI) + $(PKG) -t node$(PKG_NODE_VERSION)-macos-arm64 -o $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-macos-arm64 --no-bytecode + $(MAKE) $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-macos-arm64.sha256 + $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-win.exe: prepack | $(BINARY_RELEASES_FOLDER_TS_CLI) $(PKG) -t node$(PKG_NODE_VERSION)-win-x64 -o $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-win.exe powershell $(WORKING_DIR)/cliv2/scripts/sign_windows.ps1 $(BINARY_RELEASES_FOLDER_TS_CLI) snyk-win.exe diff --git a/binary-deployments.json b/binary-deployments.json index fec6745f3d..edd548e616 100644 --- a/binary-deployments.json +++ b/binary-deployments.json @@ -1,7 +1,7 @@ { "darwin": { "amd64": "snyk-macos", - "arm64": "snyk-macos" + "arm64": "snyk-macos-arm64" }, "windows": { "amd64": "snyk-win.exe" diff --git a/cliv2/Makefile b/cliv2/Makefile index c17972a347..95bd16d9e6 100644 --- a/cliv2/Makefile +++ b/cliv2/Makefile @@ -42,8 +42,6 @@ _SEPARATOR = _ ifeq ($(_V1_OS), darwin) _V1_OS = macos -#temporarily ignoring any architecture for macos v1 binaries, this will enable to natively compile v2 as darwin arm64 and bundle v1 as amd64 - _V1_ARCH = else ifeq ($(_V1_OS), windows) _V1_OS = win _EXE_POSTFIX = .exe diff --git a/release-scripts/release.json b/release-scripts/release.json index 247432fa19..573f727a1e 100644 --- a/release-scripts/release.json +++ b/release-scripts/release.json @@ -21,6 +21,11 @@ "sha256": "snyk-macos-sha256", "sha256Url": "https://static.snyk.io/cli/v1.0.0-monorepo/snyk-macos.sha256" }, + "snyk-macos-arm64 ": { + "url": "https://static.snyk.io/cli/v1.0.0-monorepo/snyk-macos-arm64", + "sha256": "snyk-macos-arm64-sha256", + "sha256Url": "https://static.snyk.io/cli/v1.0.0-monorepo/snyk-macos-arm64.sha256" + }, "snyk-win.exe": { "url": "https://static.snyk.io/cli/v1.0.0-monorepo/snyk-win.exe", "sha256": "snyk-win.exe-sha256", diff --git a/release-scripts/release.json.sh b/release-scripts/release.json.sh index 002093a5c1..5ed0f55f61 100755 --- a/release-scripts/release.json.sh +++ b/release-scripts/release.json.sh @@ -12,6 +12,7 @@ if [[ $(uname -s) == "Darwin" ]];then sed -i "" "s|snyk-linux-sha256|$(cat binary-releases/snyk-linux.sha256)|" "${OUTPUT_FILE}" sed -i "" "s|snyk-linux-arm64-sha256|$(cat binary-releases/snyk-linux-arm64.sha256)|" "${OUTPUT_FILE}" sed -i "" "s|snyk-macos-sha256|$(cat binary-releases/snyk-macos.sha256)|" "${OUTPUT_FILE}" + sed -i "" "s|snyk-macos-arm64-sha256|$(cat binary-releases/snyk-macos-arm64.sha256)|" "${OUTPUT_FILE}" sed -i "" "s|snyk-win.exe-sha256|$(cat binary-releases/snyk-win.exe.sha256)|" "${OUTPUT_FILE}" else echo "this is Linux" @@ -20,6 +21,7 @@ else sed -i "s|snyk-linux-sha256|$(cat binary-releases/snyk-linux.sha256)|" "${OUTPUT_FILE}" sed -i "s|snyk-linux-arm64-sha256|$(cat binary-releases/snyk-linux-arm64.sha256)|" "${OUTPUT_FILE}" sed -i "s|snyk-macos-sha256|$(cat binary-releases/snyk-macos.sha256)|" "${OUTPUT_FILE}" + sed -i "s|snyk-macos-arm64-sha256|$(cat binary-releases/snyk-macos-arm64.sha256)|" "${OUTPUT_FILE}" sed -i "s|snyk-win.exe-sha256|$(cat binary-releases/snyk-win.exe.sha256)|" "${OUTPUT_FILE}" fi diff --git a/release-scripts/upload-artifacts.sh b/release-scripts/upload-artifacts.sh index 97f776f661..133e5855b2 100755 --- a/release-scripts/upload-artifacts.sh +++ b/release-scripts/upload-artifacts.sh @@ -9,11 +9,13 @@ declare -a StaticFiles=( "binary-releases/snyk-linux" "binary-releases/snyk-linux-arm64" "binary-releases/snyk-macos" + "binary-releases/snyk-macos-arm64" "binary-releases/snyk-win.exe" "binary-releases/snyk-alpine.sha256" "binary-releases/snyk-linux.sha256" "binary-releases/snyk-linux-arm64.sha256" "binary-releases/snyk-macos.sha256" + "binary-releases/snyk-macos-arm64.sha256" "binary-releases/snyk-win.exe.sha256" "binary-releases/sha256sums.txt.asc" ) diff --git a/scripts/install-snyk.py b/scripts/install-snyk.py index 87316d4d69..d874c904b1 100755 --- a/scripts/install-snyk.py +++ b/scripts/install-snyk.py @@ -104,8 +104,10 @@ def get_filename(arch_type, os_type): if os_type == 'windows' and arch_type == 'amd64': filename = "snyk-win" suffix = ".exe" - if os_type == 'macos': + if os_type == 'macos' and arch_type == 'amd64': filename = "snyk-macos" + if os_type == 'macos' and arch_type == 'arm64': + filename = "snyk-macos-arm64" filename = filename + suffix output_filename = output_filename + suffix diff --git a/ts-binary-wrapper/test/acceptance/basic.spec.ts b/ts-binary-wrapper/test/acceptance/basic.spec.ts index ce3953e5bd..1f4431c1b4 100644 --- a/ts-binary-wrapper/test/acceptance/basic.spec.ts +++ b/ts-binary-wrapper/test/acceptance/basic.spec.ts @@ -8,7 +8,8 @@ jest.setTimeout(60 * 1000); describe('Basic acceptance test', () => { const envSetup = new TestEnvironmentSetup(); - const cliVersionForTesting = '1.1143.0'; + const cliVersionForTesting = + '1.1228.0-dev.b6d3a5aed7033dd2fe9fcc1330effeca0e4250b2'; beforeEach(async () => { process.env.SNYK_DISABLE_ANALYTICS = '1'; diff --git a/ts-binary-wrapper/test/unit/common.spec.ts b/ts-binary-wrapper/test/unit/common.spec.ts index 238870e2ae..26c80a535b 100644 --- a/ts-binary-wrapper/test/unit/common.spec.ts +++ b/ts-binary-wrapper/test/unit/common.spec.ts @@ -17,13 +17,14 @@ const supportedPlatforms = JSON.parse(binaryDeployments); describe('Determine Binary Name', () => { it('Determine Binary Name (darwin)', async () => { - const expected = supportedPlatforms['darwin']['amd64']; + const expectedamd64 = supportedPlatforms['darwin']['amd64']; + const expectedarm64 = supportedPlatforms['darwin']['arm64']; const actualx64 = common.determineBinaryName('darwin', 'x64'); const actualarm64 = common.determineBinaryName('darwin', 'arm64'); const actualamd64 = common.determineBinaryName('darwin', 'amd64'); - expect(actualx64).toEqual(expected); - expect(actualarm64).toEqual(expected); - expect(actualamd64).toEqual(expected); + expect(actualx64).toEqual(expectedamd64); + expect(actualarm64).toEqual(expectedarm64); + expect(actualamd64).toEqual(expectedamd64); }); it('Determine Binary Name (win)', async () => {