Skip to content

feat: Add SOCKS5 proxy support #1660

feat: Add SOCKS5 proxy support

feat: Add SOCKS5 proxy support #1660

Workflow file for this run

# There is a fair bit of duplication here, but it is the best to save our github free minutes for now.
# We could save and restore cache to different jobs but that takes roughly 3 minutes to save,
# so better run them in parrallel instead.
name: Session Desktop
on:
push:
branches:
- master
- dev
- "release/**"
- "ci/**"
- feat/pro-libsession
- feature/socks5-proxy-support
pull_request:
branches:
- dev
- "release/**"
- "ci/**"
- feat/pro-libsession
workflow_dispatch:
inputs:
target_branch:
description: "Branch to make a release of"
required: true
default: "master"
# Dynamic name for the run
run-name: >
Session Desktop ${{ github.event_name == 'workflow_dispatch' && format('(manual run on {0})', github.event.inputs.target_branch) || format('(push)', github.event.pull_request.number || github.ref) }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
create_draft_release_if_needed:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# we only want to publish on "push to master" or alpha releases. When we don't want to publish, we want to upload artefacts
SHOULD_PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
SHOULD_PUBLISH_ALPHA: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') && contains(github.ref, '-alpha.') }}
outputs:
# Note: It is very important to only set this when we want to do a release,
# as this will be used in the others jobs to know if we need to make a release/upload artefacts
version_tag: ${{ steps.get_version.outputs.VERSION_TAG }}
steps:
- name: Checkout git repo
uses: actions/checkout@v4
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
# We only need a few files in this run, no point cloning everything
with:
sparse-checkout: |
package.json
build/release-notes.md
build/release-notes-alpha.md
sparse-checkout-cone-mode: false
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
- name: Get version tag from package.json
# Make sure to skip this step if we do not want to make a release, as the other jobs will otherwise create a release.
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
id: get_version
run: |
version=$(node -p "require('./package.json').version")
echo "VERSION_TAG=$version" >> "$GITHUB_OUTPUT"
- name: Create draft release
# only run this on "push" to "master" or alpha releases
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
uses: ncipollo/release-action@v1
with:
tag: v${{ steps.get_version.outputs.VERSION_TAG }}
name: "Session ${{ steps.get_version.outputs.VERSION_TAG }}"
draft: true # important to keep this, so we **NEVER** make a live release through the CI
bodyFile: ${{ env.SHOULD_PUBLISH_ALPHA == 'true' && 'build/release-notes-alpha.md' || 'build/release-notes.md' }}
allowUpdates: true
# updateOnlyUnreleased: true Not needed as we already have `skipIfReleaseExists`
skipIfReleaseExists: true
makeLatest: false
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
build_linux:
runs-on: ubuntu-22.04
needs: [create_draft_release_if_needed]
strategy:
fail-fast: false
matrix:
# `electron_target` needs to be a valid target of https://www.electron.build/linux#target
include:
- identifier: deb
electron_target: deb
cache_suffix: linux-deb
is_qa: false
generate_release_metadata: true
- identifier: rpm
electron_target: rpm
cache_suffix: linux-rpm
is_qa: false
generate_release_metadata: true
- identifier: AppImage
electron_target: AppImage
cache_suffix: linux-AppImage
is_qa: false
generate_release_metadata: true
- identifier: freebsd
electron_target: freebsd
cache_suffix: linux-freebsd
is_qa: false
generate_release_metadata: false
# Note: this deb-qa is currently broken. The deb and deb-qa are currently overwriting each others
# during build-release-publish and maybe the upload-artefact too.
# - identifier: deb-qa
# electron_target: deb
# cache_suffix: linux-deb
# is_qa: true
# generate_release_metadata: false
name: "${{ matrix.identifier }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USE_HARD_LINKS: false # see https://github.com/electron-userland/electron-builder/issues/7093
steps:
- run: git config --global core.autocrlf false
- name: Checkout git repo
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
- name: Custom build for QA if needed
if: ${{ matrix.is_qa == true }}
uses: ./actions/sed_for_qa
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: ${{ matrix.cache_suffix }}
- name: Lint Files
# no need to lint files on all platforms
run: yarn lint
- name: Enforce yarn.lock has no duplicates
uses: ./actions/deduplicate_fail
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
- name: Make release build but do not publish ${{ matrix.identifier }}
# we do want this part to run only when version_tag is unset (i.e. we are not making a release)
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag == '' }}
run: |
sed -i 's/"target": "deb"/"target": "${{ matrix.electron_target }}"/g' package.json && yarn build-release
- name: Upload artefacts ${{ matrix.identifier }}
# we do want this part to run only when version_tag is unset (i.e. we are not making a release)
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag == '' }}
uses: ./actions/upload_prod_artefacts
with:
upload_prefix: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.identifier }}
- name: Make release build & publish ${{ matrix.identifier }}
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
run: |
sed -i 's/"target": "deb"/"target": "${{ matrix.electron_target }}"/g' package.json && yarn build-release-publish
- name: Backup release metadata
# only run this on "push" to "master" or alpha releases
# Note: The jobs are overwriting each other's latest-linux.yml.
# So, we upload all of them as artifacts, and then merge them (see `post_build_linux`)
# note: freebsd does not generate a latest-linux.yml file so we exclude it, same for the deb-qa build
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' && matrix.generate_release_metadata == true }}
shell: bash
run: |
mv dist/latest-linux.yml dist/latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml
- name: Upload release metadata
# only run this on "push" to "master" or alpha releases
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' && matrix.generate_release_metadata == true }}
uses: actions/upload-artifact@v4
with:
name: latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml
path: dist/latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml
post_build_linux:
needs: [create_draft_release_if_needed, build_linux]
runs-on: ubuntu-22.04
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout git repo
uses: actions/checkout@v4
# We only need a few files in this run, no point cloning everything
with:
sparse-checkout: |
package.json
build/setup-release-combine.sh
sparse-checkout-cone-mode: false
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
- name: Download release metadata
uses: actions/download-artifact@v4
with:
pattern: latest-linux-*-${{ github.sha }}.yml
path: dist
merge-multiple: true
- name: Combine release metadata
run: |
./build/setup-release-combine.sh ${{ github.sha }} linux
- name: Upload changes to draft release
uses: ncipollo/release-action@v1
with:
# the if at the job level checks that version_tag is not empty
tag: v${{ needs.create_draft_release_if_needed.outputs.version_tag }}
artifacts: "dist/latest-linux.yml"
draft: true # important to keep this, so we **NEVER** make a live release through the CI
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
replacesArtifacts: true
updateOnlyUnreleased: true
makeLatest: false
build_windows:
runs-on: windows-2022
needs: [create_draft_release_if_needed]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: "windows x64"
steps:
- run: git config --global core.autocrlf false
- name: Checkout git repo
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: "windows_x64"
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
- name: Make release build but do not publish
# always run this, except on "push" to "master" or alpha releases
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag == '' }}
run: yarn build-release
- name: Upload artefacts
# we do want this part to run only when version_tag is unset (i.e. we are not making a release)
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag == '' }}
uses: ./actions/upload_prod_artefacts
with:
upload_prefix: ${{ runner.os }}-${{ runner.arch }}
- name: Make release build & publish
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
run: yarn build-release-publish # No other args needed for windows publish
# We want both arm64 and intel mac builds, and according to this https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources macos-14 and above is always arm64 and macos-15 is the last intel runner
# NOTE x64 builds made on an arm64 host will not bundle the native modules correctly https://github.com/electron-userland/electron-builder/issues/8646
build_mac:
strategy:
matrix:
include:
- architecture: arm64
cache_suffix: mac-arm64
runner: macos-14
- architecture: x64
cache_suffix: mac-x64
runner: macos-15-intel
runs-on: ${{ matrix.runner }}
name: "${{ matrix.architecture }}"
needs: [create_draft_release_if_needed]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
steps:
- run: git config --global core.autocrlf false
- name: Checkout git repo
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: ${{ matrix.cache_suffix }}
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
- name: Make release build ${{ matrix.architecture }}
uses: ./actions/make_release_build
with:
architecture: ${{ matrix.architecture }}
should_publish: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
post_build_mac:
needs: [create_draft_release_if_needed, build_mac]
runs-on: ubuntu-22.04
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout git repo
uses: actions/checkout@v4
# We only need a few files in this run, no point cloning everything
with:
sparse-checkout: |
package.json
build/setup-release-combine.sh
sparse-checkout-cone-mode: false
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
- name: Download release metadata
uses: actions/download-artifact@v4
with:
pattern: latest-mac-*-${{ github.sha }}.yml
path: dist
merge-multiple: true
- name: Combine release metadata
run: |
./build/setup-release-combine.sh ${{ github.sha }} mac
- name: Upload changes to draft release
uses: ncipollo/release-action@v1
# the if at the job level checks that version_tag is not empty
with:
tag: v${{ needs.create_draft_release_if_needed.outputs.version_tag }}
artifacts: "dist/latest-mac.yml"
draft: true # important to keep this, so we **NEVER** make a live release through the CI
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
replacesArtifacts: true
updateOnlyUnreleased: true
makeLatest: false