1
0
mirror of synced 2026-01-19 01:47:07 +00:00
Frank Halasz 4b95a8b5d3
Windows installer and medley script for running Medley in Docker on Windows (#1077)
* Update docker file build to use new deb linux installers;  move Dockefile to .github/workflows since its really only useable from the buildDocker.yml workflow

* Fix typo in dockerfile location

* remove extraneous " in >>GITHUB_ENV statements

* Fix handling of TARGETPLATFORM in Dockerfile

* Trying with just one platform

* Fix issues with missing man-db in docker build workflow; added man-db to depends in deb builds for linux

* Sicthed docker from tightvnc to tigervnc to match oio.  This getting the apt package name right.

* Going back to single platform to debug this thing

* Trying with just arm64

* Removing arm/v7 from docker images.  Takes too long to build and just wastes our github actions minutes.  This is assuming its a never used feature since docker is not big on raspberry pis and their ilk.

* Fix typo in control-linux; update build_deb so that files in /usr/local installed by deb are owned by root; add ubuntu user and nano in docker file for dbebugging;  when in draft only create for x86_64 platform

* Fix typo in buildDocker.yml

* Add sudo to docker image; in docker image ensure that all /usr/local/interlisp files are owned by root

* Add securityTypes none to docker entrypoint

* Updated docker base to Ubuntu 22.10 to get fixed xrdp; add xrdp to the docker image; updated user permission in docker image;

* In Dockerfile make xrdp install noninteractive

* Update medley.sh scripts to handle docker case

* Fix a couple of typos

* BuildDcoker: added pulling latest draft release (if any) when this is a draft docker build; removed checkout of medley code cause its not used

* BuildDocker: added medley checkout backin - turns pout its needed by a bunch of actions even though I dont really think they use it

* BuildDocker: moved download assets to use gh instaed of a marketplace action becauase that action could not handle draft releases.

* Tweaking medley.sh and associated tweaks to work Windows via wsl medley and docker

* adding first pass at powershell script for windows docker and wsl

* Tuning how Xvnc, medley, and vncviewer handle the various ways of exiting - eg logout vs closing viewer window.

* Tuning vncviewer launch to make sure that tty works as expected when medley.sh runs in background

* Minor typo fixes and added extra check to use of /run/shm in medley_vnc.sh

* Added SSH_KEY secret to buildReleaseIncDocker workflow

* Gertting the add SSH_KEY secret into orkflows right this time, hopefully

* Adding TERM env variable and setting USER to medley in docker image

* Debugging medley.ps1 and adding a couple of arguments

* Typo in Dockerfile medley

* Synchronizing flag processing and usage for medley.ps1 and medley.sh; refactored medley_args.sh and medley_usage.sh code.

* Adding first pass at windows installer

* Adding first pass an inno setup script for Windows installation

* Update buildLoadup workflow and downloads page for windows installer

* Fix typo in buildLoadup

* BuildLoadup make sure windows runner uses powershell

* Another typo in buildLoadup

* Another typo in buildLoadup; damn those double quotes

* Updating handling of windows installer in buildLoadup, added vncviewer to medley.iss install

* Unknown syntax error in buildLoadup

* Another damn typo from double quotes

* buildLoadup: fixed loadup job outputs

* buidLoadup: fixed bug with COMBINED_RELEASE_TAG; fixed Upload script in windows job to be compatible with actions.script v6.

* buidLoadup: upload win installer adapted to find draft releases as well as full releases

* BuildLoadup: fixing up javascript in actions in windows job to use / instead of \ in pathname

* BuildLoadup: changing win installer update to same action used for other release assets

* Fix windows installer file name; in BuildLoadup move update downl;oad page to the Windows runner because uploading the window-installer changes the release download url, so updating the downloads page must be done after the windows installer upload.; General buildLoadup cleanup

* Run md2html to update downloads page

* Fix typo in build_deb.sh

* Removing some leftover crud in medley_usage.sh

* Fixing up windows installer a bit, mostly cosmetic

* Adding support for WSL1; mostly forcing --vnc and changing how to find open ports and displays since WSL1 networking is different tha WSL2

* Update manual page for new Windows Medley script

* First pass done for man page that incorporates new Windows medley script.  Add Xvnc wait before calling run-medley in case of docker to prevent occasonal missing X windows server error.

* Change buildLoadup to update man page to a draft if this is a draft run.
2023-02-18 06:19:57 -08:00

463 lines
17 KiB
YAML

#*******************************************************************************
# buidLoadup.yml
#
# Interlisp workflow to build Medley release and push it to github. This workflow
# is platform independent - but runs on Linux/amd64.
#
# This workflow contains a sentry that causes it to skip the build (as identified
# by its commit SHA) if its already been done. Setting the "force" input to true
# will bypass this sentry,
#
# 2022-01-17 Frank Halasz based on an earlier version of buildLoadup for Medley.
#
# Copyright 2022-2023 by Interlisp.org
#
# ******************************************************************************
name: Build/Push Medley Release
# Run this workflow on ...
on:
workflow_dispatch:
inputs:
draft:
description: "Mark this as a draft release"
type: choice
options:
- 'false'
- 'true'
force:
description: "Force build even if build already successfully completed for this commit"
type: choice
options:
- 'false'
- 'true'
workflow_call:
outputs:
successful:
description: "'True' if medley build completed successully"
value: ${{ jobs.complete.outputs.build_successful }}
inputs:
draft:
description: "Mark this as a draft release"
required: false
type: string
default: 'false'
force:
description: "Force build even if build already successfully completed for this commit"
required: false
type: string
default: 'false'
secrets:
OIO_SSH_KEY:
required: true
defaults:
run:
shell: bash
jobs:
######################################################################################
# Regularize the inputs so they can be referenced the same way whether they are
# the result of a workflow_dispatch or a workflow_call
inputs:
runs-on: ubuntu-latest
outputs:
draft: ${{ steps.one.outputs.draft }}
force: ${{ steps.one.outputs.force }}
steps:
- id: one
run: >
if [ '${{ toJSON(inputs) }}' = 'null' ];
then
echo "workflow_dispatch";
echo "draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT;
echo "force=${{ github.event.inputs.force }}" >> $GITHUB_OUTPUT;
else
echo "workflow_call";
echo "draft=${{ inputs.draft }}" >> $GITHUB_OUTPUT;
echo "force=${{ inputs.force }}" >> $GITHUB_OUTPUT;
fi
######################################################################################
# Use sentry-action to determine if this release has already been built
# based on the latest commit to the repo
sentry:
needs: inputs
runs-on: ubuntu-latest
outputs:
release_not_built: ${{ steps.check.outputs.release_not_built }}
steps:
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }}
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
# Check if build already run for this commit
- name: Build already completed?
id: check
continue-on-error: true
uses: ./../actions/check-sentry-action
with:
tag: "loadup"
######################################################################################
#
# Do the loadup
#
loadup:
runs-on: ubuntu-latest
outputs:
combined_release_tag: ${{ steps.job_outputs.outputs.COMBINED_RELEASE_TAG }}
medley_release_tag: ${{ steps.job_outputs.outputs.MEDLEY_RELEASE_TAG }}
medley_short_release_tag: ${{ steps.job_outputs.outputs.MEDLEY_SHORT_RELEASE_TAG }}
debs_filename_base: ${{ steps.debs.outputs.DEBS_FILENAME_BASE }}
needs: [inputs, sentry]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
steps:
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }}
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
# Checkout latest commit
- name: Checkout Medley
uses: actions/checkout@v3
# Setup release tag
- name: Setup Release Tag
id: tag
uses: ./../actions/release-tag-action
# Get Maiko release information, retrieves the name of the latest
# release. Used to download the correct Maiko release
- name: Get Maiko Release Information
id: maiko
uses: abatilo/release-info-action@v1.3.2
with:
owner: ${{ github.repository_owner }}
repo: maiko
# Setup environment variables & establish job outputs
- name: Setup Environment Variables
run: |
echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_OUTPUT}
echo "TARBALL_DIR=installers/deb/tmp/tarballs" >>${GITHUB_ENV}
echo "DEBS_DIR=installers/deb/debs" >>${GITHUB_ENV}
echo "TARS_DIR=installers/deb/tars" >>${GITHUB_ENV}
echo "MEDLEY_RELEASE_TAG=${RELEASE_TAG}" >>${GITHUB_ENV}
echo "MAIKO_RELEASE_TAG=${{ steps.maiko.outputs.latest_tag }}" >>${GITHUB_ENV}
- name: More Environment Variables
run: |
echo "MEDLEY_SHORT_RELEASE_TAG=${MEDLEY_RELEASE_TAG#medley-}" >>${GITHUB_ENV}
echo "MAIKO_SHORT_RELEASE_TAG=${MAIKO_RELEASE_TAG#maiko-}" >>${GITHUB_ENV}
- name: Even More Environment Variables
run: |
echo "COMBINED_RELEASE_TAG=${MEDLEY_SHORT_RELEASE_TAG}_${MAIKO_SHORT_RELEASE_TAG}" >>${GITHUB_ENV}
- name: Establish job outputs
id: job_outputs
run: |
echo "COMBINED_RELEASE_TAG=${COMBINED_RELEASE_TAG}" >> $GITHUB_OUTPUT;
echo "MEDLEY_RELEASE_TAG=${MEDLEY_RELEASE_TAG}" >> $GITHUB_OUTPUT;
echo "MEDLEY_SHORT_RELEASE_TAG=${MEDLEY_SHORT_RELEASE_TAG}" >> $GITHUB_OUTPUT;
# Setup some needed dirs in workspace
- name: Create work dirs
run: mkdir -p ${TARBALL_DIR}
# Download Maiko Release Assets
- name: Download Release Assets
uses: robinraju/release-downloader@v1.6
with:
repository: ${{ github.repository_owner }}/maiko
token: ${{ secrets.GITHUB_TOKEN }}
latest: true
out-file-path: ${{ env.TARBALL_DIR }}
fileName: "${{ env.MAIKO_RELEASE_TAG }}-linux.*.tgz"
- name: Untar Maiko Release for use in loadup
run: |
tar -xzf "${TARBALL_DIR}/${{ env.MAIKO_RELEASE_TAG }}-linux.x86_64.tgz"
# Checkout Notecards and tar it in the tarballsdir
- name: Checkout Notecards
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/notecards
path: ./notecards
- run: mv ./notecards ../notecards
- name: Tar notecards into tarball dir
run: |
cd ..
tar cfz medley/${TARBALL_DIR}/notecards.tgz notecards
# Install vnc
- name: Install vnc
run: sudo apt-get update && sudo apt-get install -y tightvncserver
- name: Build Loadup sysouts and databases
run: |
Xvnc -geometry 1280x720 :0 &
export DISPLAY=":0"
PATH="$PWD/maiko:$PATH"
scripts/loadup-all.sh -apps
- name: Build loadups release tar
run: |
cd ..
mkdir -p medley/${TARBALL_DIR}
tar cfz medley/${TARBALL_DIR}/${MEDLEY_RELEASE_TAG}-loadups.tgz \
medley/loadups/lisp.sysout \
medley/loadups/full.sysout \
medley/loadups/apps.sysout \
medley/loadups/whereis.hash \
medley/library/exports.all
- name: Build runtime release tar
run: |
cd ..
mkdir -p medley/${TARBALL_DIR}
tar cfz medley/${TARBALL_DIR}/${MEDLEY_RELEASE_TAG}-runtime.tgz \
--exclude "*~" --exclude "*#*" \
--exclude exports.all \
medley/clos \
medley/docs/dinfo \
medley/docs/man-page/medley.1.gz \
medley/doctools \
medley/greetfiles \
medley/rooms \
medley/medley \
medley/run-medley \
medley/scripts \
medley/fonts/displayfonts \
medley/fonts/altofonts \
medley/fonts/adobe \
medley/fonts/postscriptfonts \
medley/library \
medley/lispusers \
medley/sources \
medley/internal
# Build the deb files as well as the tgz files
- name: Build .deb files for 3 architectures
id: debs
run: |
cd installers/deb
debs_filename_base=$(./build_deb.sh)
echo "DEBS_FILENAME_BASE=${debs_filename_base}" >> $GITHUB_ENV;
echo "DEBS_FILENAME_BASE=${debs_filename_base}" >> $GITHUB_OUTPUT;
# Push the release up to github releases
- name: Delete existing release with same tag (if any)
uses: cb80/delrel@latest
with:
tag: ${{ env.MEDLEY_RELEASE_TAG }}
continue-on-error: true
- name: Push the release
id: push_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts:
${{ env.TARBALL_DIR }}/${{ env.MEDLEY_RELEASE_TAG }}-loadups.tgz,
${{ env.TARBALL_DIR }}/${{ env.MEDLEY_RELEASE_TAG }}-runtime.tgz,
${{ env.DEBS_DIR }}/*.deb,
${{ env.TARS_DIR }}/*.tgz
tag: ${{ env.MEDLEY_RELEASE_TAG }}
draft: ${{ needs.inputs.outputs.draft }}
prerelease: false
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
#
# Create the Windows installer, push it up to the release on github and
# update the downloads page on OIO
#
windows_installer:
runs-on: windows-latest
needs: [inputs, sentry, loadup]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
steps:
# Checkout latest commit
- name: Checkout Medley
uses: actions/checkout@v3
# Store the values output from loadup job as environment variables
- name: Environment Variables
shell: powershell
run: |
$crt="${{ needs.loadup.outputs.combined_release_tag }}"
echo "COMBINED_RELEASE_TAG=$crt" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
$mrt="${{ needs.loadup.outputs.medley_release_tag }}"
echo "MEDLEY_RELEASE_TAG=$mrt" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
$msrt="${{ needs.loadup.outputs.medley_short_release_tag }}"
echo "MEDLEY_SHORT_RELEASE_TAG=$msrt" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
$debs="${{ needs.loadup.outputs.debs_filename_base }}"
echo "DEBS_FILENAME_BASE=$debs" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
# Download vnc viewer
- name: Download vncviewer
shell: powershell
run: |
$url = "https://sourceforge.net/projects/tigervnc/files/stable/1.12.0/vncviewer64-1.12.0.exe"
$output = "installers\win\vncviewer64-1.12.0.exe"
(New-Object System.Net.WebClient).DownloadFile($url, $output)
# Run iscc.exe to compile the installer
- name: Compile medley.iss
shell: powershell
run: |
iscc installers\win\medley.iss
$filename="medley-install_${env:COMBINED_RELEASE_TAG}_x64.exe"
echo "INSTALLER_FILENAME=$filename" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
# Upload windows installer to release
- name: Upload windows installer to release
id: push
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: installers/win/${{ env.INSTALLER_FILENAME }}
tag: ${{ env.MEDLEY_RELEASE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
# Install the OpenSSH Client
- name: Install the OpenSSH Client
shell: powershell
run: |
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Update the downloads page and the man page on OIO
- name: Update the downloads page and the man page to the OIO static page host
shell: bash
run: |
# Figure out filenames
download_url="${{ steps.push.outputs.html_url }}"
download_url="${download_url/\/tag\//\/download\/}"
local_template="installers/downloads_page/medley_downloads.html"
local_filename="medley_downloads.html"
local_manpath="docs/man-page/man_medley.html"
if [ "${{ needs.inputs.outputs.draft }}" = "true" ];
then
remote_filename="draft_downloads"
remote_manname="man_draft.html"
else
remote_filename="${local_filename%.html}"
remote_manname="man_medley.html"
fi
remote_filepath="/srv/oio/static/${remote_filename}"
remote_manpath="/srv/oio/static/${remote_manname}"
# Fill in downloads page template
sed \
-e "s/@@@MEDLEY.SHORT.RELEASE.TAG@@@/${MEDLEY_SHORT_RELEASE_TAG}/g" \
-e "s~@@@DOWNLOAD_URL@@@~${download_url}~g" \
-e "s/@@@DEBS.FILENAME.BASE@@@/${DEBS_FILENAME_BASE}/g" \
-e "s/@@@WINDOWS.INSTALLER.FILENAME@@@/${INSTALLER_FILENAME}/g" \
< "${local_template}" > "${local_filename}"
# Create sftp instruction file
echo "-rm ${remote_filepath}.oldold" > batch
echo "-rename ${remote_filepath}.old ${remote_filepath}.oldold" >> batch
echo "-rename ${remote_filepath}.html ${remote_filepath}.old" >> batch
echo "-put ${local_filename} ${remote_filepath}.html" >> batch
echo "-put ${local_manpath} ${remote_manpath}" >> batch
# Do the sftp
eval $(ssh-agent)
ssh-add - <<< "${SSH_KEY}"
sftp -o StrictHostKeyChecking=no -b batch ubuntu@online.interlisp.org
env:
SSH_KEY: ${{ secrets.OIO_SSH_KEY }}
######################################################################################
# Use set-sentry-action to determine set the sentry that says this release has
# been successfully built
complete:
runs-on: ubuntu-latest
outputs:
build_successful: ${{ steps.output.outputs.build_successful }}
needs: [inputs, sentry, loadup, windows_installer]
steps:
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }}
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
# Set sentry
- name: Set flag that build for this commit has been completed
id: set
uses: ./../actions/set-sentry-action
with:
tag: "loadup"
- name: Output
id: output
run: |
echo "build_successful='true'" >> $GITHUB_OUTPUT
######################################################################################
# - name: Download the Windows installer created in windows job
# uses: actions/download-artifact@v3
# with:
# name: windows_installer
# path: installers/win
# - name: Rename the Windows installer w/ version tag
# run: |
# maiko_release_tag="${{ steps.maiko.outputs.latest_tag }}"
# combined_release_tag="${MEDLEY_RELEASE_TAG#medley-}_${maiko_release_tag#maiko-}"
# windows_installer_filename="medley_install_${combined_release_tag}_x64.exe"
# cd installers/win
# mv medley_install_vXXXVERSIONXXX_x64.exe "${windows_installer_filename}"
# echo "WINDOWS_INSTALLER_FILENAME=${windows_installer_filename}" >>${GITHUB_ENV}