Skip to content

Build binary for device #152

Build binary for device

Build binary for device #152

Workflow file for this run

name: build
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
remote:
name: Build for ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Move .ccache
shell: bash
run: |
mkdir -p "$nuitka_cache" .ccache
mv .ccache "$nuitka_cache/ccache"
env:
nuitka_cache: ${{ github.workspace }}/.nuitka
- uses: actions/setup-python@v4
with:
python-version: '3.8'
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Install dependencies
shell: bash
run: |
pip install wheel
pip install -r requirements.remote.txt
pip install nuitka
- name: Build codexctl
shell: bash
run: |
mkdir -p dist
NUITKA_CACHE_DIR="$nuitka_cache" \
python -m nuitka \
--enable-plugin=pylint-warnings \
--onefile \
--lto=yes \
--assume-yes-for-downloads \
--remove-output \
--output-dir=dist \
codexctl.py
env:
nuitka_cache: ${{ github.workspace }}/.nuitka
- name: Move .ccache
shell: bash
run: |
mv "$nuitka_cache/ccache" .ccache
env:
nuitka_cache: ${{ github.workspace }}/.nuitka
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: dist
if-no-files-found: error
device:
name: Build for remarkable
runs-on: ubuntu-latest
steps:
- name: Checkout the codexctl repository
uses: actions/checkout@v4
- uses: Eeems-Org/run-in-remarkable-action@v1
with:
clean_cache: true
run: |
set -eu
echo "Installing dependencies"
python -m pip install -r requirements.txt
echo "Building codexctl"
python -m PyInstaller \
--noconfirm \
--runtime-tmpdir /tmp \
--onefile \
--strip \
codexctl.py
setup: |
set -eu
opkg update
echo "Installing basic build tools"
opkg install \
gcc \
binutils \
busybox \
gawk \
ldd \
make \
sed \
tar \
patchelf
echo "Installing recommended build tools"
opkg --force-overwrite \
install \
coreutils-install \
diffutils \
ldconfig \
patch \
pkg-config
echo "Installing automake, cmake, meson, and ninja"
opkg install \
automake \
libintl-full \
libtool-bin \
cmake \
icu \
libopenssl \
bash \
git \
git-http python3-pip \
python3-setuptools \
coreutils-od \
python3-psutil \
python3-bcrypt \
python3-cryptography
python3 -m pip install -U wheel
cd /opt/tmp
git clone https://github.com/ninja-build/ninja.git
cd ./ninja
git checkout release
CONFIG_SHELL=/opt/bin/bash python3 ./configure.py --bootstrap
install -Dm0755 -t /opt/bin ./ninja
cd /opt/tmp
rm -Rf /opt/tmp/ninja
python3 -m pip install -U meson
echo "Installing header files"
opkg install --force-overwrite --force-reinstall \
libncurses-dev \
libxml2-dev \
python3-dev \
ruby-dev \
zlib-dev
/opt/bin/busybox wget -qO- "$(/opt/bin/busybox sed -Ene \
's|^src/gz[[:space:]]entware[[:space:]]https?([[:graph:]]+)|http\1/include/include.tar.gz|p' \
/opt/etc/opkg.conf)" | /opt/bin/busybox tar x -vzC /opt/include
echo "Installing python dependencies"
opkg install \
python3-cryptography \
python3-bcrypt \
python3-requests \
python3-psutil
ln -s /opt/lib/libffi.so.8 /opt/lib/libffi.so
python3 -m pip install -U \
pip \
setuptools \
pyinstaller
- uses: actions/upload-artifact@v3
with:
name: remarkable
path: dist/codexctl
if-no-files-found: error
release:
name: Release
needs: [remote,device]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Set current date as env variable
run: |
echo "NAME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "TAG=$(date +%s)" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Rename artifacts
run: |
ls artifacts | while read artifact; do
pushd artifacts/${artifact}
zip -r ../${artifact}.zip .
popd
done
- uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/*.zip"
name: ${{ env.NAME }}
tag: ${{ env.TAG }}
commit: ${{ github.sha }}
generateReleaseNotes: true
makeLatest: true