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 .deb and .rpm packages for Linux #2182

Merged
merged 19 commits into from
Feb 3, 2024
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
102 changes: 102 additions & 0 deletions .github/workflows/build-release-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: "Positron: Build Linux Releases"


# Callable workflow that builds Positron for Linux
# Note: our releases are now multi-platform, coordinated by build-release.yml
on:
workflow_call:
inputs:
build_number:
required: false
description: "The build distance number only, e.g. 123"
default: "999"
type: string
short_version:
required: true
description: "The short version number, including the build distance, e.g. 2023.12.0-123"
default: "2099.12.0-999"
type: string
workflow_dispatch:

# Ideally we'd have the `vscode-linux-prepare-` and
# `vscode-linux-build-` steps in different jobs, but the
# upload-artifact action to send the Positron build to these jobs fails
# because of https://github.com/actions/upload-artifact/issues/485

jobs:
build-binaries:
name: Build Linux binaries
runs-on: ubuntu-latest-8x
timeout-minutes: 120

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
POSITRON_BUILD_NUMBER: ${{ inputs.build_number }}

strategy:
max-parallel: 1
matrix:
arch: [x64]

steps:
# Checkout sources
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup Build Environment
run: |
sudo apt-get update
sudo apt-get install -y vim curl build-essential clang make cmake git python3-pip python-is-python3 libsodium-dev libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1 libnss3 libnspr4 libasound2 libkrb5-dev

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Execute yarn
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_PAT }}
run: |
# Install Yarn
npm install -g yarn

# Install node-gyp; this is required by some packages, and yarn
# sometimes fails to automatically install it.
yarn global add node-gyp

# Perform the main yarn command; this installs all Node packages and
# dependencies
yarn --immutable --network-timeout 120000

- name: Build Positron
run: |
yarn gulp vscode-linux-${{ matrix.arch }}

- name: Prepare binary
run: |
yarn gulp vscode-linux-${{ matrix.arch }}-prepare-deb
yarn gulp vscode-linux-${{ matrix.arch }}-prepare-rpm

# There is only .deb or .rpm file generated by the gulp "build"
# step. The `*` globs in the `mv` command will match a single
# file and are just a convenient way of matching the generated
# filename.
- name: Build binary
run: |
yarn gulp vscode-linux-${{ matrix.arch }}-build-deb
yarn gulp vscode-linux-${{ matrix.arch }}-build-rpm
mv .build/linux/deb/*/deb/*.deb Positron-${{ inputs.short_version }}.deb
mv .build/linux/rpm/*/*.rpm Positron-${{ inputs.short_version }}.rpm

- name: Upload .rpm
uses: actions/upload-artifact@v4
with:
name: positron-binary-rpm
path: Positron-${{ inputs.short_version }}.rpm

- name: Upload .deb
uses: actions/upload-artifact@v4
with:
name: positron-binary-deb
path: Positron-${{ inputs.short_version }}.deb
4 changes: 2 additions & 2 deletions .github/workflows/build-release-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
build_number:
required: false
description: "The build distance number only, e.g. 123"
default: ${{ github.sha }}
default: "999"
type: string
short_version:
required: true
description: "The short version number, including the build distance, e.g. 2023.12.0-123"
default: ${{ github.sha }}
default: "2099.12.0-999"
type: string
outputs:
artifact-name:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
short_version:
required: false
description: "The short version number, including the build distance, e.g. 2023.12.0-123"
default: ${{ github.sha }}
default: "2099.12.0-999"
type: string
outputs:
artifact-name:
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ jobs:
with:
short_version: ${{ needs.version_string.outputs.short_version }}

linux-binaries:
uses: ./.github/workflows/build-release-linux.yml
needs: version_string
secrets: inherit
with:
short_version: ${{ needs.version_string.outputs.short_version }}

releases:
runs-on: ubuntu-latest
needs: [version_string, macos-installer, windows-installer]
Expand Down Expand Up @@ -137,3 +144,40 @@ jobs:
asset_path: ${{ needs.windows-installer.outputs.artifact-file }}
asset_name: ${{ needs.windows-installer.outputs.artifact-file }}
asset_content_type: application/octet-stream

linux-releases:
needs: [linux-binaries, releases]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
short_version: ${{ needs.version_string.outputs.short_version }}
steps:
- name: Download Linux artifacts
uses: actions/download-artifact@v4
id: download-linux-artifact
if: github.ref == 'refs/heads/main'
with:
pattern: positron-binary-*

- name: Upload Linux .deb release asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.releases.outputs.upload_url }}
asset_path: Positron-${{ steps.short_version.outputs.result }}.deb
asset_name: Positron-${{ steps.short_version.outputs.result }}.deb
asset_content_type: application/octet-stream

- name: Upload Linux .rpm release asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.releases.outputs.upload_url }}
asset_path: Positron-${{ steps.short_version.outputs.result }}.rpm
asset_name: Positron-${{ steps.short_version.outputs.result }}.rpm
asset_content_type: application/octet-stream
2 changes: 1 addition & 1 deletion .github/workflows/positron-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Build Environment
run: |
sudo apt-get update
sudo apt-get install -y vim curl build-essential clang make cmake git r-base-dev python3-pip python-is-python3 libsodium-dev libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1 libnss3 libnspr4 libasound2 libkrb5-dev
sudo apt-get install -y vim curl build-essential clang make cmake git python3-pip python-is-python3 libsodium-dev libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1 libnss3 libnspr4 libasound2 libkrb5-dev
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
Expand Down
6 changes: 5 additions & 1 deletion build/linux/dependencies-generator.js

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

5 changes: 5 additions & 0 deletions extensions/jupyter-adapter/positron.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"to": "prebuilds/win32-x64",
"platforms": ["win32"]
},
{
"from": "node_modules/zeromq/prebuilds/linux-x64/node.napi.glibc.node",
"to": "prebuilds/linux-x64",
"platforms": ["linux"]
},
{
"from": "resources/kernel-wrapper.*",
"to": "resources"
Expand Down
13 changes: 12 additions & 1 deletion extensions/positron-r/scripts/install-kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,18 @@ async function downloadAndReplaceArk(version: string,
console.error(`Could not find Ark ${version} in the releases.`);
return;
}
const os = platform() === 'win32' ? 'windows-x64' : 'darwin-universal';

let os: string;
switch (platform()) {
case 'win32': os = 'windows-x64'; break;
case 'darwin': os = 'darwin-universal'; break;
case 'linux': os = 'linux-x64'; break;
default: {
console.error(`Unsupported platform ${platform()}.`);
return;
}
}

const assetName = `ark-${version}-${os}.zip`;
const asset = release.assets.find((asset: any) => asset.name === assetName);
if (!asset) {
Expand Down
Loading