feat(release): manager debug workflow (#1055)

* basic workflow sketch

* metrics server also needs lint

* update names

* latest?

* that's weird.

* ok that's a start. refactor next

* fix path

* oops

* ah

* no op

* make it like the other ones

* refactor scripts

* fix shellcheck

* ah okay

* upload mac artifact

* Update .travis.yml

Co-authored-by: Vinicius Fortuna <fortuna@users.noreply.github.com>

* comments

* add todo

Co-authored-by: Vinicius Fortuna <fortuna@users.noreply.github.com>
This commit is contained in:
Daniel LaCosse 2022-03-08 14:01:08 -05:00 committed by GitHub
parent f420ca917e
commit 5a4966cf7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 290 additions and 371 deletions

View file

@ -0,0 +1,190 @@
name: Build and Test
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
pull_request:
types:
- opened
- synchronize
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Install Node
uses: actions/setup-node@v2.2.0
with:
node-version: 16
cache: npm
- name: Install NPM Dependencies
run: npm ci
- name: Lint
run: npm run lint
shadowbox:
name: Shadowbox
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Install Node
uses: actions/setup-node@v2.2.0
with:
node-version: 16
cache: npm
- name: Install NPM Dependencies
run: npm ci
- name: Shadowbox Debug Build
run: npm run action shadowbox/server/build
- name: Shadowbox Unit Test
run: npm run action shadowbox/test
- name: Shadowbox Integration Test
run: npm run action shadowbox/integration_test/run
metrics-server:
name: Metrics Server
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Install Node
uses: actions/setup-node@v2.2.0
with:
node-version: 16
cache: npm
- name: Install NPM Dependencies
run: npm ci
- name: Metrics Server Debug Build
run: npm run action metrics_server/build
- name: Metrics Server Test
run: npm run action metrics_server/test
manager-web-test:
name: Manager Web Test
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Install Node
uses: actions/setup-node@v2.2.0
with:
node-version: 16
cache: npm
- name: Install NPM Dependencies
run: npm ci
- name: Manager Web Test
run: npm run action server_manager/test
manager-linux-debug-build:
name: Manager Linux Debug Build
runs-on: ubuntu-latest
needs: manager-web-test
env:
SENTRY_DSN: debug
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Install Node
uses: actions/setup-node@v2.2.0
with:
node-version: 16
cache: npm
- name: Install NPM Dependencies
run: npm ci
- name: Build Linux Manager
run: npm run action server_manager/electron_app/build --platform linux
- name: Upload Linux Client
uses: actions/upload-artifact@v2
with:
name: manager_linux_debug
path: build/server_manager/electron_app/static/dist/Outline-Manager.AppImage
if-no-files-found: error
manager-windows-debug-build:
name: Manager Windows Debug Build
runs-on: windows-2019
needs: manager-web-test
env:
SENTRY_DSN: debug
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Install Node
uses: actions/setup-node@v2.2.0
with:
node-version: 16
cache: npm
- name: Install NPM Dependencies
run: npm ci
- name: Build Windows Manager
run: npm run action server_manager/electron_app/build --platform windows
- name: Upload Windows Manager
uses: actions/upload-artifact@v2
with:
name: manager_windows_debug
path: build/server_manager/electron_app/static/dist/Outline-Manager.exe
if-no-files-found: error
manager-mac-debug-build:
name: Manager MacOS Debug Build
runs-on: macos-11
needs: manager-web-test
env:
SENTRY_DSN: debug
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Install Node
uses: actions/setup-node@v2.2.0
with:
node-version: 16
cache: npm
- name: Install NPM Dependencies
run: npm ci
- name: Set XCode Version
run: sudo xcode-select -switch /Applications/Xcode_13.2.app
- name: Build MacOS Manager
run: npm run action server_manager/electron_app/build --platform mac
- name: Upload MacOS Manager
uses: actions/upload-artifact@v2
with:
name: manager_macos_debug
path: build/server_manager/electron_app/static/dist/Outline-Manager.dmg
if-no-files-found: error

View file

@ -1,61 +0,0 @@
name: Release Manager
on:
push:
tags:
- "v[0-9]*"
env:
SENTRY_DSN: https://533e56d1b2d64314bd6092a574e6d0f1@o74047.ingest.sentry.io/215496
jobs:
release_manager:
name: Release Manager
runs-on: ${{ matrix.os }}
environment: Production Outline Manager
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
# Don't cancel jobs on other platforms if one fails
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v2
with:
cache: npm
node-version: 16
- name: Show Environment Info
run: |
npm -v
openssl version
env
- name: Install Dependencies
run: npm ci
- name: Release Linux
if: runner.os == 'Linux'
run: npm run action server_manager/electron_app/release_linux
- name: Release MacOS
if: runner.os == 'macOS'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
ENCRYPTED_SIGNING_CERT_IV: ${{ secrets.ENCRYPTED_SIGNING_CERT_IV }}
ENCRYPTED_SIGNING_CERT_KEY: ${{ secrets.ENCRYPTED_SIGNING_CERT_KEY }}
run: |
openssl aes-256-cbc -K $ENCRYPTED_SIGNING_CERT_KEY -iv $ENCRYPTED_SIGNING_CERT_IV -in macos-signing-certificate.p12.enc -out macos-signing-certificate.p12 -d -md sha256
export CSC_LINK=$(pwd)/macos-signing-certificate.p12
npm run action server_manager/electron_app/release_macos
- name: Deploy
uses: softprops/action-gh-release@v1
with:
files: "build/server_manager/electron_app/static/dist/*.*"
draft: true

View file

@ -1,57 +0,0 @@
name: Build and Test
on:
pull_request:
branches:
- master
types:
- opened
- synchronize
jobs:
manager:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
# This matches the Ubuntu version used in our Travis releases
os: [ubuntu-20.04]
# Don't cancel jobs on other platforms if one fails
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v1
- name: Install Node.js
uses: actions/setup-node@v1
with:
cache: npm
node-version: 16
- name: Install dependencies
run: NODE_DTRACE_PROVIDER_REQUIRE=hard npm ci
- name: Lint
run: npm run lint
- name: Manager
run: |
SENTRY_DSN='test' npm run action server_manager/electron_app/release_linux
npm run action server_manager/test
- name: Shadowbox
if: runner.os == 'Linux'
run: |
npm run action shadowbox/server/build
npm run action shadowbox/test
npm run action shadowbox/integration_test/start
- name: Metrics Server
if: runner.os == 'Linux'
run: |
npm run action metrics_server/build
npm run action metrics_server/test

View file

@ -1,3 +1,7 @@
# -- DEPRECATED: FOR REFERENCE ONLY --
# Due to security issues with travis, we are in the process
# of migrating to github actions: https://github.com/features/actions.
language: node_js
node_js:
@ -69,7 +73,7 @@ jobs:
addons:
apt:
packages:
- rpm
- rpm
script: npm run action server_manager/electron_app/release_linux
- stage: "Manager Release"

View file

@ -13,8 +13,28 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eux
# Builds the Electron App
PLATFORM=$1
STAGING_PERCENTAGE=100
BUILD_MODE=debug
for i in "$@"; do
case ${i} in
--buildMode=*)
BUILD_MODE="${i#*=}"
shift
;;
--stagingPercentage=*)
STAGING_PERCENTAGE="${i#*=}"
shift
;;
--* | -*)
echo "Unknown option: ${i}"
exit 1
;;
*) ;;
esac
done
readonly OUT_DIR="${BUILD_DIR}/server_manager/electron_app"
rm -rf "${OUT_DIR}"
@ -40,8 +60,14 @@ cp -r "${BUILD_DIR}/server_manager/web_app/static" "${STATIC_DIR}/server_manager
# is loaded via a custom protocol.
cp src/server_manager/package.json package-lock.json "${STATIC_DIR}"
cd "${STATIC_DIR}"
npm install --prod --ignore-scripts
npm ci --prod --ignore-scripts
# Icons.
cd "${ROOT_DIR}"
electron-icon-maker --input=src/server_manager/images/launcher-icon.png --output=build/server_manager/electron_app/static
# TODO(daniellacosse): refactor these scripts into node so we can call the electron builder there directly
# shellcheck disable=SC2046
electron-builder $(node src/server_manager/scripts/get_electron_build_flags.mjs "${PLATFORM}" --buildMode "${BUILD_MODE}")
src/server_manager/scripts/finish_info_files.sh "${PLATFORM}" "${STAGING_PERCENTAGE}"

View file

@ -1,35 +0,0 @@
#!/bin/bash -eu
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
npm run action server_manager/electron_app/build
readonly BUILD_DIR='build/server_manager/electron_app/static'
"${ROOT_DIR}/src/server_manager/node_modules/.bin/electron-builder" \
--projectDir="${BUILD_DIR}" \
--config.asarUnpack=server_manager/web_app/images \
--config.generateUpdatesFilesForAllChannels=true \
--publish=never \
--config.publish.provider=generic \
--config.publish.url=https://raw.githubusercontent.com/Jigsaw-Code/outline-releases/master/manager/ \
--linux AppImage \
--config.linux.icon=icons/png \
--config.linux.category=Network \
--config.artifactName="Outline-Manager.\${ext}"
src/server_manager/scripts/finish_info_files.sh linux "${STAGING_PERCENTAGE}"

View file

@ -1,35 +0,0 @@
#!/bin/bash -eu
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
npm run action server_manager/electron_app/build
readonly BUILD_DIR=build/server_manager/electron_app/static
# Produces dmg and zip images. The latter is required for auto-update.
"${ROOT_DIR}/src/server_manager/node_modules/.bin/electron-builder" \
--projectDir="${BUILD_DIR}" \
--config.asarUnpack=server_manager/web_app/images \
--config.generateUpdatesFilesForAllChannels=true \
--publish=never \
--config.publish.provider=generic \
--config.publish.url=https://raw.githubusercontent.com/Jigsaw-Code/outline-releases/master/manager/ \
--mac default \
--config.mac.icon=icons/mac/icon.icns \
--config.artifactName="Outline-Manager.\${ext}"
src/server_manager/scripts/finish_info_files.sh mac "${STAGING_PERCENTAGE}"

View file

@ -1,31 +0,0 @@
#!/bin/bash -eu
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is mostly intended for the continuous build, which takes place
# in a Docker container. *Building* is not supported by that Docker image
# so we build separately.
"${ROOT_DIR}/src/server_manager/node_modules/.bin/electron-builder" \
--projectDir=build/server_manager/electron_app/static \
--config.asarUnpack=server_manager/web_app/images \
--config.generateUpdatesFilesForAllChannels=true \
--publish=never \
--config.publish.provider=generic \
--config.publish.url=https://raw.githubusercontent.com/Jigsaw-Code/outline-releases/master/manager/ \
--ia32 \
--win nsis \
--config.win.icon=icons/win/icon.ico \
--config.artifactName="Outline-Manager.\${ext}"

View file

@ -1,38 +0,0 @@
#!/bin/bash -eu
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
export BUILD_ENV='production'
npm run action server_manager/electron_app/build
npm run action server_manager/electron_app/write_production_environment
readonly BUILD_DIR=build/server_manager/electron_app/static
"${ROOT_DIR}/node_modules/.bin/electron-builder" \
--projectDir="${BUILD_DIR}" \
--config.asarUnpack=server_manager/web_app/images \
--config.generateUpdatesFilesForAllChannels=true \
--publish=never \
--config.publish.provider=generic \
--config.publish.url=https://raw.githubusercontent.com/Jigsaw-Code/outline-releases/master/manager/ \
--linux AppImage \
--config.linux.icon=icons/png \
--config.linux.category=Network \
--config.artifactName="Outline-Manager.\${ext}"
src/server_manager/scripts/finish_info_files.sh linux "${STAGING_PERCENTAGE}"

View file

@ -1,45 +0,0 @@
#!/bin/bash -eu
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
readonly CSC_LINK=${CSC_LINK:-unset}
if [[ "${CSC_LINK}" == "unset" ]]; then
echo "must specify CSC_LINK"
exit 1
fi
source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
export BUILD_ENV='production'
npm run action server_manager/electron_app/build
npm run action server_manager/electron_app/write_production_environment
readonly BUILD_DIR=build/server_manager/electron_app/static
# Produces dmg and zip images. The latter is required for auto-update.
"${ROOT_DIR}/src/server_manager/node_modules/.bin/electron-builder" \
--projectDir="${BUILD_DIR}" \
--config.asarUnpack=server_manager/web_app/images \
--config.generateUpdatesFilesForAllChannels=true \
--publish=never \
--config.publish.provider=generic \
--config.publish.url=https://raw.githubusercontent.com/Jigsaw-Code/outline-releases/master/manager/ \
--mac default \
--config.mac.icon=icons/mac/icon.icns \
--config.artifactName="Outline-Manager.\${ext}"
src/server_manager/scripts/finish_info_files.sh mac "${STAGING_PERCENTAGE}"

View file

@ -1,39 +0,0 @@
#!/bin/bash -eu
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
export BUILD_ENV='production'
npm run action server_manager/electron_app/build
npm run action server_manager/electron_app/write_production_environment
readonly BUILD_DIR=build/server_manager/electron_app/static
"${ROOT_DIR}/src/server_manager/node_modules/.bin/electron-builder" \
--projectDir="${BUILD_DIR}" \
--config.asarUnpack=server_manager/web_app/images \
--config.generateUpdatesFilesForAllChannels=true \
--publish=never \
--config.publish.provider=generic \
--config.publish.url=https://raw.githubusercontent.com/Jigsaw-Code/outline-releases/master/manager/ \
--ia32 \
--win nsis \
--config.win.icon=icons/win/icon.ico \
--config.win.certificateSubjectName='Jigsaw Operations LLC' \
--config.artifactName="Outline-Manager.\${ext}"
src/server_manager/scripts/finish_info_files.sh win "${STAGING_PERCENTAGE}"

View file

@ -1,27 +0,0 @@
#!/bin/bash -eu
#
# Copyright 2020 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Writes a dotenv file for CI environment variables.
# Fail if any release variables are undefined.
if [[ -z "${SENTRY_DSN:-}" ]]; then
echo "SENTRY_DSN is undefined."
exit 1
fi
cat <<EOM > "${BUILD_DIR}/server_manager/electron_app/static/.env"
SENTRY_DSN=${SENTRY_DSN}
EOM

View file

@ -0,0 +1,67 @@
// Copyright 2022 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import minimist from "minimist";
import url from "url";
export async function getElectronBuildFlags(platform, buildMode) {
let buildFlags = [
"--projectDir=build/server_manager/electron_app/static",
"--config.asarUnpack=server_manager/web_app/images",
"--publish=never",
'--config.artifactName="Outline-Manager.${ext}"',
];
switch (platform) {
case "linux":
buildFlags = ["--linux", "--config.linux.icon=icons/png", "--config.linux.category=Network", ...buildFlags];
break;
case "windows":
buildFlags = ["--win", "--ia32", "--config.win.icon=icons/win/icon.ico", ...buildFlags];
break;
case "mac":
buildFlags = ["--mac", "--config.mac.icon=icons/mac/icon.icns", ...buildFlags];
}
if (buildMode === "release") {
// Publishing is disabled, updates are pulled from AWS. We use the generic provider instead of the S3
// provider since the S3 provider uses "virtual-hosted style" URLs (my-bucket.s3.amazonaws.com)
// which can be blocked by DNS or SNI without taking down other buckets.
buildFlags = [
...buildFlags,
"--config.generateUpdatesFilesForAllChannels=true",
"--config.publish.provider=generic",
`--config.publish.url=${process.env.RELEASES_REPOSITORY}`,
];
}
if (buildMode === "release" && platform === "windows") {
buildFlags.push("--config.win.certificateSubjectName='Jigsaw Operations LLC'");
}
return buildFlags;
}
async function main() {
const {_, buildMode} = minimist(process.argv);
const platform = _[2];
console.log((await getElectronBuildFlags(platform, buildMode)).join(" "));
}
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
(async function() {
return main();
})();
}