Replace github actions with drone ci

This commit is contained in:
Jason Rhinelander 2022-06-23 13:56:51 -03:00
parent a3a7d8c235
commit fb1c853197
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
6 changed files with 158 additions and 242 deletions

100
.drone.jsonnet Normal file
View File

@ -0,0 +1,100 @@
local docker_image = 'registry.oxen.rocks/lokinet-ci-nodejs';
local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q';
[
{
kind: 'pipeline',
type: 'docker',
name: 'Linux (amd64)',
platform: { arch: 'amd64' },
steps: [
{
name: 'build',
image: docker_image,
environment: {
SSH_KEY: { from_secret: 'SSH_KEY' },
NODE_OPTIONS: '--openssl-legacy-provider',
},
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
'./tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-linux-LATEST.tar.xz',
'npm --version',
'node --version',
'mkdir -p $CCACHE_DIR/electron-builder',
'mkdir -p $CCACHE_DIR/npm',
'npm ci --cache $CCACHE_DIR/npm',
'ELECTRON_BUILDER_CACHE=$CCACHE_DIR/electron-builder npm --cache $CCACHE_DIR/npm run build',
'./tools/ci-drone-static-upload.sh',
],
},
],
},
{
kind: 'pipeline',
type: 'docker',
name: 'Windows (x64)',
platform: { arch: 'amd64' },
steps: [
{
name: 'build',
image: docker_image,
environment: {
SSH_KEY: { from_secret: 'SSH_KEY' },
WINEDEBUG: '-all',
NODE_OPTIONS: '--openssl-legacy-provider',
},
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata zip',
'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
'./tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-win-LATEST.zip',
'wine bin/oxend.exe --version',
'wine bin/oxen-wallet-rpc.exe --version',
'npm --version',
'node --version',
'mkdir -p $CCACHE_DIR/electron-builder',
'mkdir -p $CCACHE_DIR/npm',
'npm ci --cache $CCACHE_DIR/npm',
'ELECTRON_BUILDER_CACHE=$CCACHE_DIR/electron-builder npm --cache $CCACHE_DIR/npm run windows',
'./tools/ci-drone-static-upload.sh',
],
},
],
},
{
kind: 'pipeline',
type: 'exec',
name: 'MacOS (unsigned)',
platform: { os: 'darwin', arch: 'amd64' },
steps: [
{
name: 'build',
environment: {
SSH_KEY: { from_secret: 'SSH_KEY' },
CSC_IDENTITY_AUTO_DISCOVERY: 'false',
},
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'./tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-macos-LATEST.tar.xz',
'npm --version',
'node --version',
'mkdir -p $CCACHE_DIR/electron-builder',
'mkdir -p $CCACHE_DIR/npm',
'npm ci --cache $CCACHE_DIR/npm',
'ELECTRON_BUILDER_CACHE=$CCACHE_DIR/electron-builder WINEDEBUG=-all npm --cache $CCACHE_DIR/npm run build',
'./tools/ci-drone-static-upload.sh',
],
},
],
},
]

View File

@ -1,88 +0,0 @@
name: Oxen Electron Wallet Build
on:
push:
branches:
- master
- development
pull_request:
# The branches below must be a subset of the branches above
branches:
- master
- development
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Checkout git repo
uses: actions/checkout@v1
- name: Download macos oxend binaries
if: runner.os == 'macOS'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-macos-LATEST.tar.xz
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Download windows oxend binaries
if: runner.os == 'Windows'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-win-LATEST.zip
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Download linux oxend binaries
if: runner.os == 'Linux'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-linux-LATEST.tar.xz
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
# Read node version from `.nvmrc` file
- name: Read nvm rc
id: nvmrc
uses: browniebroke/read-nvmrc-action@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvmrc.outputs.node_version }}
- name: Install dependencies
run: npm install
- name: Build window and linux binaries
if: runner.os != 'macOS'
run: npm run build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build mac binaries
if: runner.os == 'macOS'
run: npm run build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.MAC_CERTIFICATE }}
CSC_KEY_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 }}
- name: Remove un-needed artifacts
run: rm -r -- ./*/
shell: bash
working-directory: ./dist/electron/Packaged
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: ${{ runner.OS }}
path: dist/electron/Packaged

View File

@ -1,82 +0,0 @@
name: Oxen Electron Wallet With Dev Binaries
on:
push:
branches:
- dev-bins
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Checkout git repo
uses: actions/checkout@v1
- name: Download macos oxend binaries
if: runner.os == 'macOS'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-dev-macos-LATEST.tar.xz
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Download windows oxend binaries
if: runner.os == 'Windows'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-dev-win-LATEST.zip
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Download linux oxend binaries
if: runner.os == 'Linux'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-dev-linux-LATEST.tar.xz
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
# Read node version from `.nvmrc` file
- name: Read nvm rc
id: nvmrc
uses: browniebroke/read-nvmrc-action@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvmrc.outputs.node_version }}
- name: Install dependencies
run: npm install
- name: Build window and linux binaries
if: runner.os != 'macOS'
run: npm run build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build mac binaries
if: runner.os == 'macOS'
run: npm run build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.MAC_CERTIFICATE }}
CSC_KEY_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 }}
- name: Remove un-needed artifacts
run: rm -r -- ./*/
shell: bash
working-directory: ./dist/electron/Packaged
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: ${{ runner.OS }}
path: dist/electron/Packaged

View File

@ -1,71 +0,0 @@
name: Oxen Electron Wallet Release
on:
push:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Checkout git repo
uses: actions/checkout@v1
- name: Download macos oxend binaries
if: runner.os == 'macOS'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-macos-LATEST.tar.xz
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Download windows oxend binaries
if: runner.os == 'Windows'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-win-LATEST.zip
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Download linux oxend binaries
if: runner.os == 'Linux'
run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-linux-LATEST.tar.xz
env:
OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
# Read node version from `.nvmrc` file
- name: Read nvm rc
id: nvmrc
uses: browniebroke/read-nvmrc-action@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvmrc.outputs.node_version }}
- name: Install dependencies
run: npm install
- name: Publish window and linux binaries
if: runner.os != 'macOS'
run: npm run release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish mac binaries
if: runner.os == 'macOS'
run: npm run release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.MAC_CERTIFICATE }}
CSC_KEY_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 }}

View File

@ -16,7 +16,7 @@
"scripts": {
"dev": "quasar dev -m electron",
"build": "quasar build -m electron --publish=never",
"release": "quasar build -m electron --publish=always",
"windows": "quasar build -m electron --publish=never -T win",
"lint": "eslint --fix .",
"format": "prettier --write \"**/*.+(js|jsx|json|yml|yaml|css|md|vue)\"",
"ready": "npm run lint && npm run format"

57
tools/ci-drone-static-upload.sh Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Script used with Drone CI to upload build artifacts (because specifying all this in
# .drone.jsonnet is too painful).
set -o errexit
if [ -z "$SSH_KEY" ]; then
echo -e "\n\n\n\e[31;1mUnable to upload artifact: SSH_KEY not set\e[0m"
# Just warn but don't fail, so that this doesn't trigger a build failure for untrusted builds
exit 0
fi
echo "$SSH_KEY" >ssh_key
set -o xtrace # Don't start tracing until *after* we write the ssh key
chmod 600 ssh_key
branch_or_tag=${DRONE_BRANCH:-${DRONE_TAG:-unknown}}
upload_to="oxen.rocks/${DRONE_REPO// /_}/${branch_or_tag// /_}"
puts=
for f in dist/electron/Packaged/{oxen-electron-wallet-*,latest*.yml}; do
if [[ $f = *\** ]]; then # Unexpanded glob means it didn't match anything
echo "Did not find any files matching $f"
ls --color -F -l dist/electron/Packaged
exit 1
fi
puts="$puts
put $f $upload_to"
done
# sftp doesn't have any equivalent to mkdir -p, so we have to split the above up into a chain of
# -mkdir a/, -mkdir a/b/, -mkdir a/b/c/, ... commands. The leading `-` allows the command to fail
# without error.
upload_dirs=(${upload_to//\// })
mkdirs=
dir_tmp=""
for p in "${upload_dirs[@]}"; do
dir_tmp="$dir_tmp$p/"
mkdirs="$mkdirs
-mkdir $dir_tmp"
done
sftp -i ssh_key -b - -o StrictHostKeyChecking=off drone@oxen.rocks <<SFTP
$mkdirs
$puts
SFTP
set +o xtrace
echo -e "\n\n\n\n\e[32;1mUploaded to https://${upload_to}/${filename}\e[0m\n\n\n"