diff --git a/.github/workflows/upstream_font_sync.yml b/.github/workflows/upstream_font_sync.yml new file mode 100644 index 0000000..0c60b16 --- /dev/null +++ b/.github/workflows/upstream_font_sync.yml @@ -0,0 +1,20 @@ +name: Check for new upstream font data +on: + pull_request: + branches: [main] + push: + branches: [main] + schedule: + - cron: '0 0 * * 0' +jobs: + check_upstream_changes: + name: Check upstream changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@stable + + - uses: Check generated fonts file + run: ./regenerate_fonts_file_from_upstream.sh --check --hide-progress diff --git a/regenerate_fonts_file_from_upstream.sh b/regenerate_fonts_file_from_upstream.sh new file mode 100644 index 0000000..f5c6fd3 --- /dev/null +++ b/regenerate_fonts_file_from_upstream.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -eu + +SCRIPTPATH=$( + cd "$(dirname "$(readlink -f "$0")")" || exit 1 + pwd -P +) +cd "$SCRIPTPATH/tools/generate_fonts_file" + +TMP_DIR=$(mktemp -d) + +# check if tmp dir was created +if [[ ! "$TMP_DIR" || ! -d "$TMP_DIR" ]]; then + echo "Could not create temp dir" + exit 1 +fi + +# Remove temp dir on exit +function cleanup { + rm -rf "$TMP_DIR" + echo "Deleted temp working directory $TMP_DIR" +} +trap cleanup EXIT + +curl --no-progress-meter --fail-with-body --output-dir "$TMP_DIR" -O https://raw.githubusercontent.com/olikraus/u8g2/master/csrc/u8g2_fonts.c + +cargo run --release -- "$@" "$TMP_DIR/u8g2_fonts.c" "$SCRIPTPATH/src/fonts.rs"