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

Build Linux aarch64 packages using the new GH runner #8306

Merged
merged 8 commits into from
Jan 28, 2025
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
15 changes: 9 additions & 6 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ jobs:
- os: ubuntu-latest
csc_link_secret: ''
csc_key_password_secret: ''
- os: ubuntu-24.04-arm
csc_link_secret: ''
csc_key_password_secret: ''
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -84,7 +87,7 @@ jobs:
CSC_KEY_PASSWORD: ${{ matrix.csc_key_password_secret != '' && secrets[matrix.csc_key_password_secret] || '' }}

- name: Package app (Linux only)
if: matrix.os == 'ubuntu-latest'
if: runner.os == 'Linux'
shell: bash
run: npm run app-package
env:
Expand Down Expand Up @@ -195,7 +198,7 @@ jobs:
run: npm run artifacts -w insomnia-inso

- name: Create inso Docker Image artifacts
if: matrix.os == 'ubuntu-latest'
if: runner.os == 'Linux'
run: |
DOCKER_BUILDKIT=1 docker build --tag ${{ env.INSO_PACKAGE_NAME }}:temp ./packages/${{ env.INSO_PACKAGE_NAME }}
docker save ${{ env.INSO_PACKAGE_NAME }}:temp -o ./packages/${{ env.INSO_PACKAGE_NAME }}/artifacts/${{ env.INSO_DOCKER_TAR }}
Expand All @@ -204,10 +207,10 @@ jobs:
# Automatically uploads to workflow assets
- name: Scan inso docker artifacts
id: sbom_action
if: matrix.os == 'ubuntu-latest'
if: runner.os == 'Linux'
uses: Kong/public-shared-actions/security-actions/scan-docker-image@28d20a1f492927f35b00b317acd78f669c45f88b # v2.7.3
with:
asset_prefix: image-inso-${{ runner.os }}
asset_prefix: image-inso-${{ runner.os }}-${{ runner.arch }}
image: ./packages/${{ env.INSO_PACKAGE_NAME }}/artifacts/${{ env.INSO_DOCKER_TAR }}
upload-sbom-release-assets: false # No release is publushed yet. Uploads as workflow assets
skip_cis_scan: true
Expand All @@ -218,7 +221,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: ${{ matrix.os }}-artifacts
name: ${{ runner.os }}-${{ runner.arch }}-artifacts
path: |
packages/insomnia/dist/*.exe
packages/insomnia/dist/squirrel-windows/*
Expand All @@ -234,7 +237,7 @@ jobs:
- name: Upload source assets for Sentry
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-sentry
name: ${{ runner.os }}-${{ runner.arch }}-sentry
path: |
packages/insomnia/build/*.js
packages/insomnia/build/*.map
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,6 @@ jobs:
release_id: ${{ steps.core_tag_and_release.outputs.id }}
tag_name: ${{ env.RELEASE_CORE_TAG }}
file: "./artifacts/*-artifacts/insomnia/dist/Insomnia.*;./artifacts/*-artifacts/insomnia/dist/squirrel-windows/*;./artifacts/*-artifacts/insomnia-inso/artifacts/inso-*;./artifacts/**/*sbom.{spdx,cyclonedx}.json"
# /github/workspace/artifacts/windows-latest-artifacts/***/dist/squirrel-windows/Insomnia.Core-9.3.0-beta.1.exe
# /github/workspace/artifacts/windows-latest-artifacts/***/dist/squirrel-windows/Insomnia.Core-9.3.0-beta.1-full.nupkg
# /github/workspace/artifacts/windows-latest-artifacts/***/dist/squirrel-windows/RELEASES
# /home/runner/work/***/***/artifacts/macos-13-artifacts/***/dist/Insomnia.Core-9.3.0-alpha.7.dmg
# /home/runner/work/***/***/artifacts/ubuntu-latest-artifacts/***/dist/Insomnia.Core-9.3.0-alpha.7.deb
# /home/runner/work/***/***/artifacts/ubuntu-latest-artifacts/***-inso/artifacts/inso-linux-9.3.0-alpha.7.tar.xz
# /home/runner/work/***/***/artifacts/macos-13-artifacts/***-inso/artifacts/inso-macos-13-9.3.0-alpha.7.pkg
# /home/runner/work/***/***/artifacts/image-inso-Linux-sbom.spdx.json/image-inso-Linux-sbom.spdx.json
# /home/runner/work/***/***/artifacts/sbom.cyclonedx.json/sbom.cyclonedx.json
prerelease: ${{ env.IS_PRERELEASE }}
draft: false

Expand Down Expand Up @@ -153,9 +144,10 @@ jobs:
RELEASE_VERSION: ${{ env.INSO_VERSION }}
RELEASE_CHANNEL: ${{ contains(github.event.inputs.version, 'beta') && 'beta' || 'stable' }}

# TODO: also take care of aarch64 image
- name: Load the Inso CLI Docker Archive
run: |
docker load -i ./artifacts/ubuntu-latest-artifacts/insomnia-inso/artifacts/inso-docker-image.tar
docker load -i ./artifacts/Linux-X64-artifacts/insomnia-inso/artifacts/inso-docker-image.tar
docker image ls

- name: Login to Docker Hub
Expand All @@ -177,7 +169,6 @@ jobs:
sep-tags: ","

- name: Push Inso CLI docker image tags to Docker Hub
id: publish_isno_docker_image
run: |
for tag in ${IMAGE_TAGS//,/ }; do \
docker tag insomnia-inso:temp $tag
Expand Down Expand Up @@ -241,15 +232,25 @@ jobs:
env:
RELEASE_GH_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}

- name: Upload to snapcraft (beta and stable only)
- name: Upload x64 Linux snap to snapcraft (beta and stable only)
if: ${{ !contains(github.event.inputs.version, 'alpha') }}
uses: canonical/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN_FILE_NEW }}
with:
snap: artifacts/ubuntu-latest-artifacts/insomnia/dist/Insomnia.Core-${{ env.RELEASE_VERSION }}.snap
snap: artifacts/Linux-X64-artifacts/insomnia/dist/Insomnia.Core-${{ env.RELEASE_VERSION }}-x64.snap
release: ${{ contains(github.event.inputs.version, 'beta') && 'beta' || 'stable' }}

- name: Upload arm64 Linux to snapcraft (beta and stable only)
if: ${{ !contains(github.event.inputs.version, 'alpha') }}
uses: canonical/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN_FILE_NEW }}
with:
snap: artifacts/Linux-ARM64-artifacts/insomnia/dist/Insomnia.Core-${{ env.RELEASE_VERSION }}-arm64.snap
release: ${{ contains(github.event.inputs.version, 'beta') && 'beta' || 'stable' }}

# TODO: also release for aarch64 Linux?
- name: Upload .deb to pulp and/or cloudsmith (stable only)
if: ${{ !contains(github.event.inputs.version, 'alpha') && !contains(github.event.inputs.version, 'beta') }}
uses: docker://kong/release-script:latest
Expand All @@ -267,7 +268,7 @@ jobs:
entrypoint: /entrypoint.sh
args: >
release
--file artifacts/ubuntu-latest-artifacts/insomnia/dist/Insomnia.Core-${{ env.RELEASE_VERSION }}.deb
--file artifacts/Linux-X64-artifacts/insomnia/dist/Insomnia.Core-${{ env.RELEASE_VERSION }}-x64.deb
--dist-name ubuntu
--dist-version focal
--package-type insomnia
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release-recurring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
build-targets: "portable"
- os: "ubuntu-22.04"
build-targets: "tar.gz"
- os: "ubuntu-24.04-arm"
build-targets: "tar.gz"
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand All @@ -53,7 +55,7 @@ jobs:
- name: Package
shell: bash
run: NODE_OPTIONS='--max_old_space_size=6144' BUILD_TARGETS='${{ matrix.build-targets }}' npm run app-package

# - name: Set publish metadata # Checksum for provenance must be calculated before moving artifacts temporarily
# id: metadata
# run: |
Expand All @@ -65,6 +67,11 @@ jobs:
# CLI_ARTIFACT_SHAFILE: ${{runner.temp}}/cli.sha256
# ELECTRON_ARTIFACT_SHAFILE: ${{runner.temp}}/electron.sha256

# See https://github.com/electron/electron/issues/42510#issuecomment-2171583086
- if: ${{ runner.os == 'Linux' }}
name: Lift unprivileged user namespace restrictions
run: sudo sysctl kernel/apparmor_restrict_unprivileged_userns=0

- name: Test critical path on packaged electron app
run: npm run test:package -w packages/insomnia-smoke-test -- --project=Critical
env:
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/insomnia-inso/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPY ./artifacts/inso-linux-*.tar.xz /tmp/inso.tar.xz
RUN apt-get update && apt-get install -y xz-utils && rm -rf /var/lib/apt/lists/*
RUN tar -C /usr/bin -xvf /tmp/inso.tar.xz

FROM --platform=linux/amd64 docker.io/ubuntu:22.04
FROM docker.io/ubuntu:22.04
COPY --from=fetch /usr/bin/inso /usr/bin/inso
RUN chmod +x /usr/bin/inso
RUN apt-get update && apt-get install -y libstdc++6 && rm -rf /var/lib/apt/lists/*
Expand Down
3 changes: 2 additions & 1 deletion packages/insomnia-inso/src/scripts/artifacts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This file is responsible for compressing the binaries for each architecture
import fs from 'node:fs/promises';
import process from 'node:process';

import { ProcessEnvOptions, spawn } from 'child_process';
import path from 'path';
Expand Down Expand Up @@ -27,7 +28,7 @@ const spawnCompressProcess = (cwd: ProcessEnvOptions['cwd']) => {
platform === 'win32' ? '-a -cf' : '-cJf',
platform === 'win32'
? `inso-windows-${version}.zip`
: `inso-linux-${version}.tar.xz`,
: `inso-linux-${process.arch}-${version}.tar.xz`,
platform === 'win32' ? 'inso.exe' : 'inso',
], { cwd, shell: platform === 'win32' });
}
Expand Down
20 changes: 17 additions & 3 deletions packages/insomnia-smoke-test/playwright/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,28 @@ export const randomDataPath = () => path.join(os.tmpdir(), 'insomnia-smoke-test'
export const INSOMNIA_DATA_PATH = randomDataPath();

// Packaged app paths
const pathLookup: Record<string, string> = {
const pathLookup: Record<string, string | Record<string, string>> = {
win32: path.join('win-unpacked', 'Insomnia.exe'),
darwin: path.join('mac-universal', 'Insomnia.app', 'Contents', 'MacOS', 'Insomnia'),
linux: path.join('linux-unpacked', 'insomnia'),
linux: {
x64: path.join('linux-unpacked', 'insomnia'),
arm64: path.join('linux-arm64-unpacked', 'insomnia'),
},
};

let binaryPath: string;
const platformPath = pathLookup[process.platform]
if (typeof platformPath === 'string') {
binaryPath = platformPath
} else if (process.arch in platformPath) {
binaryPath = platformPath[process.arch]
} else {
throw new Error(`Cannot find binary path for ${process.platform} ${process.arch}`)
}

export const cwd = path.resolve(__dirname, '..', '..', 'insomnia');
const repoRoot = path.resolve(__dirname, '..', '..', '..');
const insomniaBinary = path.join(cwd, 'dist', pathLookup[process.platform]);
const insomniaBinary = path.join(cwd, 'dist', binaryPath);
const electronBinary = path.join(repoRoot, 'node_modules', '.bin', process.platform === 'win32' ? 'electron.cmd' : 'electron');

export const executablePath = bundleType() === 'package' ? insomniaBinary : electronBinary;
Expand Down
2 changes: 1 addition & 1 deletion packages/insomnia/electron-builder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const config = {
artifactName: `${BINARY_PREFIX}-\${version}-portable.\${ext}`,
},
linux: {
artifactName: `${BINARY_PREFIX}-\${version}.\${ext}`,
artifactName: `${BINARY_PREFIX}-\${version}-\${arch}.\${ext}`,
executableName: 'insomnia',
synopsis: 'The Collaborative API Client and Design Tool',
category: 'Development',
Expand Down
2 changes: 1 addition & 1 deletion packages/insomnia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@bufbuild/protobuf": "^1.8.0",
"@connectrpc/connect": "^1.4.0",
"@connectrpc/connect-node": "^1.4.0",
"@getinsomnia/node-libcurl": "^2.33.2",
"@getinsomnia/node-libcurl": "^2.33.7",
"@grpc/grpc-js": "^1.12.0",
"@grpc/proto-loader": "^0.7.13",
"@seald-io/nedb": "^4.0.4",
Expand Down
Loading