diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c8b241f --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target/* \ No newline at end of file diff --git a/.github/scripts/ubuntu/Dockerfile b/.github/scripts/ubuntu/Dockerfile new file mode 100644 index 0000000..899b46b --- /dev/null +++ b/.github/scripts/ubuntu/Dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:18.04 + +RUN apt-get update \ + && apt-get install -y libssl-dev \ + libxdo-dev libxtst-dev libx11-dev \ + wget git cmake build-essential pkg-config + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=1.55.0 + +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='ad1f8b5199b3b9e231472ed7aa08d2e5d1d539198a15c5b1e53c746aad81d27b' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='6c6c3789dabf12171c7f500e06d21d8004b5318a5083df8b0b02c0e5ef1d017b' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='26942c80234bac34b3c1352abbd9187d3e23b43dae3cf56a9f9c1ea8ee53076d' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='27ae12bc294a34e566579deba3e066245d09b8871dc021ef45fc715dced05297' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.21.1/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; + +RUN mkdir espanso + +COPY . espanso + +RUN cd espanso \ + && cargo install --force cargo-make diff --git a/.github/scripts/ubuntu/build_appimage.sh b/.github/scripts/ubuntu/build_appimage.sh new file mode 100755 index 0000000..ed49379 --- /dev/null +++ b/.github/scripts/ubuntu/build_appimage.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +echo "Testing espanso..." +cd espanso +cargo make test-binary --profile release + +echo "Building espanso and creating AppImage" +cargo make create-app-image --profile release + +cd .. +cp espanso/target/linux/AppImage/out/Espanso-*.AppImage Espanso-X11.AppImage +sha256sum Espanso-X11.AppImage > Espanso-X11.AppImage.sha256.txt +ls -la + +echo "Copying to mounted volume" +cp Espanso-X11* /shared diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93413d4..61ebb65 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,17 +57,45 @@ jobs: shell: powershell run: | Get-FileHash target/windows/Espanso-Win-Portable-x86_64.zip -Algorithm SHA256 | select-object -ExpandProperty Hash > target/windows/Espanso-Win-Portable-x86_64.zip.sha256.txt - Get-FileHash target/windows/Espanso-Win-Installer-x86_64.exe -Algorithm SHA256 | select-object -ExpandProperty Hash > target/windows/Espanso-Win-Installer-x86_64.exe.sha256.txt + Get-FileHash target/windows/installer/Espanso-Win-Installer-x86_64.exe -Algorithm SHA256 | select-object -ExpandProperty Hash > target/windows/installer/Espanso-Win-Installer-x86_64.exe.sha256.txt - uses: actions/upload-artifact@v2 name: "Upload artifacts" with: name: Windows Installer and Portable path: | - target/windows/Espanso-Win-Installer-x86_64.exe + target/windows/installer/Espanso-Win-Installer-x86_64.exe target/windows/Espanso-Win-Portable-x86_64.zip + target/windows/installer/Espanso-Win-Installer-x86_64.exe.sha256.txt + target/windows/Espanso-Win-Portable-x86_64.zip.sha256.txt - name: Upload artifacts to Github Releases run: | - gh release upload ${{ needs.extract-version.outputs.espanso_version }} target/windows/installer/Espanso-Win-Installer-x86_64.exe target/windows/installer/Espanso-Win-Portable-x86_64.zip target/windows/installer/Espanso-Win-Installer-x86_64.exe.sha256.txt target/windows/installer/Espanso-Win-Portable-x86_64.zip.sha256.txt + gh release upload ${{ needs.extract-version.outputs.espanso_version }} target/windows/installer/Espanso-Win-Installer-x86_64.exe target/windows/Espanso-Win-Portable-x86_64.zip target/windows/installer/Espanso-Win-Installer-x86_64.exe.sha256.txt target/windows/Espanso-Win-Portable-x86_64.zip.sha256.txt + + linux-x11: + needs: ["extract-version"] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Print target version + run: | + echo Using version ${{ needs.extract-version.outputs.espanso_version }} + - name: Build docker image + run: | + sudo docker build -t espanso-ubuntu . -f .github/scripts/ubuntu/Dockerfile + - name: Build AppImage + run: | + sudo docker run --rm -v "$(pwd):/shared" espanso-ubuntu espanso/.github/scripts/ubuntu/build_appimage.sh + - uses: actions/upload-artifact@v2 + name: "Upload artifacts" + with: + name: Linux X11 AppImage + path: | + shared/Espanso-X11.AppImage + shared/Espanso-X11.AppImage.sha256.txt + - name: Upload artifacts to Github Releases + run: | + gh release upload ${{ needs.extract-version.outputs.espanso_version }} shared/Espanso-X11.AppImage shared/Espanso-X11.AppImage.sha256.txt # macos-intel: # runs-on: macos-11