Skip to content

Commit

Permalink
Experiment with reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kintel committed Nov 7, 2021
1 parent e37690f commit 1a044f4
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 59 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: macos-build

on:
workflow_call:
inputs:
snapshot:
description: "Set to true to build a snapshot build instead of a release build"
default: false
required: false
type: boolean

jobs:
build:
runs-on: macos-latest
env:
OPENSCAD_LIBRARIES: /Users/runner/work/openscad/libraries/install/
LIBRARIES_CACHE: libraries.tar.gz
steps:
- name: Checkout OpenSCAD
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install Homebrew packages
run: |
brew update
brew install automake
- name: Cache Libraries
id: cache-libraries
uses: actions/cache@v2
with:
path: ${{ env.OPENSCAD_LIBRARIES }}
key: ${{ runner.os }}-libraries-${{ hashFiles('./scripts/macosx-build-dependencies.sh', '.github/workflows/macos-release.yml') }}
restore-keys: ${{ runner.os }}-libraries-
- name: Build Dependencies
run: |
export PKG_CONFIG_PATH="$OPENSCAD_LIBRARIES/lib/pkgconfig"
export DYLD_LIBRARY_PATH="$OPENSCAD_LIBRARIES/lib"
export DYLD_FRAMEWORK_PATH="$OPENSCAD_LIBRARIES/lib"
echo "PWD = $CI_BASEDIR"
echo "PATH = $PATH"
echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH"
# Pick up our own Qt
export PATH=$OPENSCAD_LIBRARIES/bin:$PATH
./scripts/macosx-build-dependencies.sh -d double_conversion eigen gmp mpfr glew gettext libffi freetype ragel harfbuzz libz libzip libxml2 fontconfig hidapi libuuid lib3mf poppler pixman cairo glib2 boost cgal qt5 opencsg qscintilla sparkle
- name: Package Dependencies as an artifact
run: |
mkdir -p ${{ runner.temp }}/out
tar cz -C "$OPENSCAD_LIBRARIES" -f ${{ runner.temp }}/out/"$LIBRARIES_CACHE" .
shasum -a 512 ${{ runner.temp }}/out/"$LIBRARIES_CACHE" > ${{ runner.temp }}/out/"$LIBRARIES_CACHE".sha512
- name: Build OpenSCAD
run: |
echo "Start building OpenSCAD: $(date)"
export PKG_CONFIG_PATH="$OPENSCAD_LIBRARIES/lib/pkgconfig"
export DYLD_LIBRARY_PATH="$OPENSCAD_LIBRARIES/lib"
export DYLD_FRAMEWORK_PATH="$OPENSCAD_LIBRARIES/lib"
export NUMCPU=$(($(sysctl -n hw.ncpu) * 3 / 2))
time ./scripts/release-common.sh
cd build
OPENSCAD_NAME=$(ls OpenSCAD-*.dmg)
shasum -a 256 "$OPENSCAD_NAME" > "$OPENSCAD_NAME".sha256
shasum -a 512 "$OPENSCAD_NAME" > "$OPENSCAD_NAME".sha512
cp -v "$OPENSCAD_NAME"* ${{ runner.temp }}/out/
echo "Finished building OpenSCAD: $(date)"
- name: Verify OpenSCAD binary
run: |
./scripts/macosx-sanity-check.py ./build/OpenSCAD.app/Contents/MacOS/OpenSCAD
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: Build Artifacts
path: ${{ runner.temp }}/out/
63 changes: 4 additions & 59 deletions .github/workflows/macos-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,7 @@ on:
- '*'

jobs:
build:
runs-on: macos-latest
env:
OPENSCAD_LIBRARIES: /Users/runner/work/openscad/libraries/install/
LIBRARIES_CACHE: libraries.tar.gz
steps:
- name: Checkout OpenSCAD
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install Homebrew packages
run: |
brew update
brew install automake
- name: Cache Libraries
id: cache-libraries
uses: actions/cache@v2
with:
path: ${{ env.OPENSCAD_LIBRARIES }}
key: ${{ runner.os }}-libraries-${{ hashFiles('./scripts/macosx-build-dependencies.sh', '.github/workflows/macos-release.yml') }}
restore-keys: ${{ runner.os }}-libraries-
- name: Build Dependencies
run: |
export PKG_CONFIG_PATH="$OPENSCAD_LIBRARIES/lib/pkgconfig"
export DYLD_LIBRARY_PATH="$OPENSCAD_LIBRARIES/lib"
export DYLD_FRAMEWORK_PATH="$OPENSCAD_LIBRARIES/lib"
echo "PWD = $CI_BASEDIR"
echo "PATH = $PATH"
echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH"
# Pick up our own Qt
export PATH=$OPENSCAD_LIBRARIES/bin:$PATH
./scripts/macosx-build-dependencies.sh -d double_conversion eigen gmp mpfr glew gettext libffi freetype ragel harfbuzz libz libzip libxml2 fontconfig hidapi libuuid lib3mf poppler pixman cairo glib2 boost cgal qt5 opencsg qscintilla sparkle
- name: Package Dependencies as an artifact
run: |
mkdir -p ${{ runner.temp }}/out
tar cz -C "$OPENSCAD_LIBRARIES" -f ${{ runner.temp }}/out/"$LIBRARIES_CACHE" .
shasum -a 512 ${{ runner.temp }}/out/"$LIBRARIES_CACHE" > ${{ runner.temp }}/out/"$LIBRARIES_CACHE".sha512
- name: Build OpenSCAD
run: |
echo "Start building OpenSCAD: $(date)"
export PKG_CONFIG_PATH="$OPENSCAD_LIBRARIES/lib/pkgconfig"
export DYLD_LIBRARY_PATH="$OPENSCAD_LIBRARIES/lib"
export DYLD_FRAMEWORK_PATH="$OPENSCAD_LIBRARIES/lib"
export NUMCPU=$(($(sysctl -n hw.ncpu) * 3 / 2))
time ./scripts/release-common.sh
cd build
OPENSCAD_NAME=$(ls OpenSCAD-*.dmg)
shasum -a 256 "$OPENSCAD_NAME" > "$OPENSCAD_NAME".sha256
shasum -a 512 "$OPENSCAD_NAME" > "$OPENSCAD_NAME".sha512
cp -v "$OPENSCAD_NAME"* ${{ runner.temp }}/out/
echo "Finished building OpenSCAD: $(date)"
- name: Verify OpenSCAD binary
run: |
./scripts/macosx-sanity-check.py ./build/OpenSCAD.app/Contents/MacOS/OpenSCAD
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: Build Artifacts
path: ${{ runner.temp }}/out/
build-release:
uses: openscad/openscad/.github/workflows/openscad-release.yml
with:
snapshot: false

0 comments on commit 1a044f4

Please sign in to comment.