Skip to content

Commit

Permalink
Release with GitHub actions (#710)
Browse files Browse the repository at this point in the history
The old external download and build server https://download.visicut.org/ is now replaced by GitHub's own features (Actions and Releases) https://github.com/t-oster/VisiCut/releases .  (For a while, both will be available in parallel.)


- Known limitation: `potrace` no longer included on Windows/Mac --> The "Vectorization" feature in VisiCut no longer works out-of-the-box on these systems. #717
- New: Linux AppImage (single executable "portable app")

- Technical change: GitHub Actions build process no longer depends on VisicutBuilder
  • Loading branch information
TheAssassin committed Mar 24, 2024
1 parent a8f89b6 commit 8797012
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 20 deletions.
57 changes: 49 additions & 8 deletions .github/workflows/github-build.yml
@@ -1,24 +1,65 @@
name: Build
run-name: ${{ github.actor }} builds using docker. The output is currently ignored

on:
push:
branches_ignore:
- gh-pages
pull_request:
branches_ignore:
- gh-pages
workflow_dispatch:

jobs:
Build:
distribute:
strategy:
fail-fast: false

matrix:
target:
- zip
- windows-nsis
- macos-bundle
- linux-appimage
- linux-checkinstall

name: Distribute ${{ matrix.target }}
runs-on: ubuntu-latest
container: 'docker://registry.gitlab.com/t-oster/visicutbuildservice'

steps:
- name: Setup directories
run: mkdir -p /app/build /app/output
- name: Run build
run: /app/build.sh
- uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0

- name: Build distribution
run: |
# we use a separate directory called output to "collect" all the build artifacts
# this makes uploading the artifacts a *lot* easier
mkdir output
pushd output
bash ../distribute/distribute-docker.sh ${{ matrix.target }}
- name: Archive built files
uses: actions/upload-artifact@v3
with:
name: output binaries
path: |
/app/output/**
output/*
upload:
name: Create release and upload artifacts
needs:
- distribute
runs-on: ubuntu-20.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Inspect directory after downloading artifacts
run: ls -alFR
- name: Create release and upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget https://github.com/TheAssassin/pyuploadtool/releases/download/20231223-1/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage "output binaries"/*.*
16 changes: 10 additions & 6 deletions distribute/Dockerfile
Expand Up @@ -6,16 +6,20 @@ SHELL ["bash", "-x", "-c"]

ENV DEBIAN_FRONTEND=noninteractive

# workaround nsis bug: https://sourceforge.net/p/nsis/bugs/1180/
ENV LANG C.UTF-8

# note: don't build with OpenJDK > 16, as this is the runtime we ship
RUN apt-get update && \
apt-get install -y openjdk-11-jdk git wget shellcheck bash make maven python3-minimal python3-pip \
nsis zip libfuse2 checkinstall makepkg && \
python3 -m pip install git+https://github.com/TheAssassin/appimagecraft.git#egg=appimagecraft
nsis zip libfuse2 checkinstall makepkg fonts-noto-extra potrace sudo && \
python3 -m pip install git+https://github.com/TheAssassin/appimagecraft.git@6b36fda#egg=appimagecraft

# create fake home directory so that maven can create a ~/.m2 directory
RUN mkdir /fakehome && \
chmod 777 /fakehome
ENV HOME=/fakehome
# we don't have a defined $HOME, but we need Maven to write the libLaserCut artifact somewhere
COPY docker/maven-settings.xml /usr/share/maven/conf/settings.xml

# we shouldn't expect FUSE to work within Docker
ENV APPIMAGE_EXTRACT_AND_RUN=1

VOLUME /visicut
RUN git config --global --add safe.directory /visicut
10 changes: 8 additions & 2 deletions distribute/distribute-docker.sh
Expand Up @@ -9,19 +9,25 @@ image_name="visicut-distribution"

docker build -t "$image_name" -f "$distribute_dir"/Dockerfile "$distribute_dir"

extra_args=()
if [[ -t 0 ]]; then
extra_args+=("-t")
fi

# mount current working directory as /cwd so that the resulting artifacts show up in it
# also mount distribute/'s parent directory so that distribute.sh has access to all the necessary files
# the reason is that we cannot predict where this script is called from but want to avoid any difference in executing
# this script instead of distribute.sh directly
docker run \
"${extra_args[@]}" \
--rm \
-e BUILD \
-e TMPDIR=/ramdisk \
-it \
-i \
-w /cwd \
-v "$PWD":/cwd \
-v "$distribute_dir/..":/visicut \
--user "$(id -u)" \
--tmpfs "/ramdisk:uid=$(id -u),gid=$(id -g),exec" \
"$image_name" \
/visicut/distribute/distribute.sh "$@"
/visicut/distribute/distribute.sh "$@"
9 changes: 5 additions & 4 deletions distribute/distribute.sh
Expand Up @@ -69,9 +69,9 @@ export VERSION
if [ "${NO_BUILD:-}" == "" ]; then
log "Building VisiCut JAR"
# TODO: make out-of-source builds possible
pushd "$project_root_dir"
make clean jar
popd
pushd "$project_root_dir"
make clean jar
popd
fi

# we "ab"use the deployment directory to create the "visicut directory"
Expand Down Expand Up @@ -143,7 +143,8 @@ for target in "$@"; do
# need to copy the NSIS files to the build dir, since relative paths are relative to the config directory
cp -Rv "$distribute_dir"/windows "$build_dir"/windows-launcher
pushd windows-launcher
makensis launcher.nsi
# force charset to UTF8, otherwise the combined license file will cause conversion errors ("unable to convert to codepage 0")
makensis -INPUTCHARSET UTF8 launcher.nsi
popd
mv -v windows-launcher/VisiCut.exe visicut/
rm -rf windows-launcher/
Expand Down
4 changes: 4 additions & 0 deletions distribute/docker/maven-settings.xml
@@ -0,0 +1,4 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>/tmp/.m2/repository</localRepository>
</settings>

0 comments on commit 8797012

Please sign in to comment.