Skip to content

Build FreeCAD MacOS app bundle #88

Build FreeCAD MacOS app bundle

Build FreeCAD MacOS app bundle #88

---
# TODOS:
# 1. [ ] setup more descriptive filenames for homebrew package cache ie. macos-14-arm64-brew-[hash]
# 2. [ ] setup step to clone the freecad github repo
# 3. [ ] cache the cloned repo.
# 4. [ ] check for outdated deps after restoring the cache
# REFS:
# 1. example of work around for updating cache: https://github.com/actions/cache/issues/342#issuecomment-1711054115
# 2. saveing & restoring cache: https://github.com/marketplace/actions/cache#skipping-steps-based-on-cache-hit
# 3. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
name: Build FreeCAD MacOS app bundle
on:
workflow_dispatch:
permissions:
contents: read
actions: write
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALL_FROM_API: 1
HOMEBREW_DEVELOPER: 1
jobs:
build:
strategy:
fail-fast: false
max-parallel: 1
matrix:
os:
- macos-14
# - macos-13
# - macos-12
runs-on: ${{ matrix.os }}
# env:
# cache-key: your-cache-key
# cache-key: ${{ env.envHash }}-freecad-deps-${{ runner.os }}-brew
timeout-minutes: 1200
steps:
- name: set foos
id: set-foos
run: |
echo "foo=bar" >> "$GITHUB_OUTPUT"
- name: print foos
id: print-foos
env:
foo: ${{ steps.set-foos.outputs.foo }}
run: echo "the value of foo is $foo"
- name: set brew prefix & cache paths
id: set-brew-prefix-and-cache-paths
run: |
bp=$(brew --prefix)
hbc="$bp/cache"
echo "bp=\"$bp\"" >> "$GITHUB_OUTPUT"
echo "hbc=\"$hbc\"" >> "$GITHUB_OUTPUT"
echo "bp=\"$bp\"" >> "$GITHUB_ENV"
echo "hbc=\"$hbc\"" >> "$GITHUB_ENV"
- name: Print Brew Prefix & Cache paths
id: print-brew-prefix-cache-paths
env:
bp: ${{ steps.set-brew-prefix-and-cache-paths.outputs.bp }}
hbc: ${{ steps.set-brew-prefix-and-cache-paths.outputs.hbc }}
run: |
echo "the value of bp is set to $bp"
echo "the value of hbc is set to $hbc"
- name: Ensure cache directory exists
run: |
mkdir -p ${{ env.hbc }}
ls -la ${{ env.hbc }}
- name: checkout
uses: actions/checkout@v3 # gh command require repository
# - name: restore cache
# id: cache-brewdeps-restore
# # uses: actions/cache/restore@v2
# uses: actions/cache@v2
# with:
# # path: /opt/homebrew
# path: ${{ env.bp }}
# key: ${{ runner.os }}-${{ github.run_id }}-brewdeps
# # key: ${{ env.cache-key }}
# # key: ${{ env.envHash }}-freecad-deps-${{ runner.os }}-brew
# # key: homebrew-packages-${{ runner.os }}-${{ github.run_id }}
# # restore-keys: |
# # homebrew-packages-${{ runner.os }}-
# # homebrew-packages-${{ runner.os }}
# restore-keys: |
# ${{ runner.os }}-${{ github.run_id }}-brewdeps
# ${{ runner.os }}-*-brew
# ${{ runner.os }}-
# - name: Remove preinstalled Homebrew packages
# if: steps.cache-brewdeps-restore.outputs.cache-hit != 'true'
# run: |
# brew list --formula | xargs brew uninstall --formula --force;
# brew list --cask | xargs brew uninstall --cask --force;
# brew cleanup
# - name: setup freecad tap
# if: steps.cache-brewdeps-restore.outputs.cache-hit != 'true'
# id: setup-freecad-tap
# run: |
# brew tap -v freecad/freecad
# NOTE: working but does not update!
# - name: install freecad deps
# id: install-freecad-deps
# uses: tecolicom/actions-install-and-cache@v1
# with:
# run: brew install --only-dependencies --formula -v freecad/freecad/freecad
# path: $(brew --prefix)
# cache: yes
# # key: ${{ runner.os }}-freecad-deps-${{ github.run_id }}-${{ hashFiles('**/Brewfile') }}
# # key: ${{ env.envHash }}-freecad-deps-${{ runner.os }}-brew
# # filename: 22bb85dd26b0ab6965dc2fef8179b253--freecad-deps-macOS-brew
# key: ${{ env.envHash }}-freecad-deps-${{ env.MACOS_VERSION }}-brew
# # filename: 22bb85dd26b0ab6965dc2fef8179b253--freecad-deps--brew
# verbose: true
# sudo: false
- name: install freecad deps
if: steps.cache-brewdeps-restore.outputs.cache-hit != 'true'
id: install-freecad-deps
# run: brew install --only-dependencies --formula -v freecad/freecad/freecad
run: |
brew install wget gh zstd
- name: update & upgrade brew & formula / packages
run: |
brew update -v;
brew upgrade -v;
# # TODO: fixme `env.cache-key` is not defined
# - name: delete previous cache
# if: ${{ steps.cache-brewdeps-restore.outputs.cache-hit }}
# continue-on-error: true
# env:
# GH_TOKEN: ${{ github.token }}
# run: |
# gh extension install actions/gh-actions-cache
# gh actions-cache delete "${{ runner.os }}-${{ github.run_id}}-brewdeps" --confirm
- name: save homebrew install
uses: actions/cache@v2
# env:
# bp: ${{ steps.set-brew-prefix-and-cache-paths.outputs.bp }}
with:
# NO WORK!
# path: $(brew --prefix)
# WORK!
# path: /opt/homebrew
path: ${{ env.bp }}
# key: ${{ env.cache-key }}
# key: ${{ env.envHash }}-freecad-deps-${{ runner.os }}-brew
# key: homebrew-packages-${{ runner.os }}-${{ github.run_id }}
# key: ${{ steps.cache-brewdeps-restore.outputs.cache-primary-key }}
key: ${{ runner.os }}-brewdeps
# - name: intentionally fail
# run: exit 1
- name: debug with tmate on failure
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3