Linux Updates #1544
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-macos | |
on: | |
push: | |
paths-ignore: | |
- '**/README.md' | |
pull_request: | |
paths-ignore: | |
- '**/README.md' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
TARGET: "osx" | |
NO_FORCE: 1 | |
GA_CI_SECRET: ${{ secrets.CI_SECRET }} | |
USE_ARTIFACT: true | |
DISABLE_WORKFLOW: "true" | |
jobs: | |
pre-check: | |
runs-on: ubuntu-latest | |
outputs: | |
workflow_disabled: ${{ steps.check-disabled.outputs.disabled }} | |
steps: | |
- name: Check if Workflow is disabled | |
id: check-disabled | |
shell: bash | |
run: | | |
if [ "${{ env.DISABLE_WORKFLOW }}" == "true" ]; then | |
echo "disabled=true" >> $GITHUB_ENV | |
echo "::set-output name=disabled::true" | |
else | |
echo "::set-output name=disabled::false" | |
fi | |
build-macos-platforms: | |
if: needs.pre-check.outputs.workflow_disabled != 'true' | |
runs-on: macos-14 | |
needs: pre-check | |
strategy: | |
matrix: | |
bundle: [1, 2, 3] | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
DEVELOPER_DIR: "/Applications/Xcode.app/Contents/Developer" | |
steps: | |
- name: Determine Release | |
id: vars | |
shell: bash | |
run: | | |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
echo "RELEASE=${{ github.ref_name }}" >> $GITHUB_ENV | |
elif [[ "${{ github.ref }}" == "refs/heads/master" ]]; then | |
echo "RELEASE=nightly" >> $GITHUB_ENV | |
elif [[ "${{ github.ref }}" == "refs/heads/bleeding" ]]; then | |
echo "RELEASE=latest" >> $GITHUB_ENV | |
else | |
echo "RELEASE=latest" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v4.2.2 | |
- name: Scripts Calc Formula - ${{ env.TARGET }} Bundle ${{ matrix.bundle }} | |
run: ./scripts/calculate_formulas.sh | |
- name: Scripts Install | |
run: ./scripts/osx/install.sh | |
- name: 'Download artifacts' | |
uses: actions/github-script@v7 | |
if: env.USE_ARTIFACT == 'true' | |
with: | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
const outputDir = path.join(process.env.GITHUB_WORKSPACE, 'out'); | |
if (!fs.existsSync(outputDir)){ | |
fs.mkdirSync(outputDir); | |
} | |
// https://api.github.com/repos/openframeworks/apothecary/actions/artifacts?per_page=250 | |
const artifacts = await github.rest.actions.listArtifactsForRepo({ | |
owner: 'openframeworks', | |
repo: 'apothecary', | |
sort: 'created_at', | |
direction: 'desc', | |
per_page: 150 | |
}); | |
const target = process.env.TARGET; | |
const bundle = process.env.MATRIX_BUNDLE; | |
const release = process.env.RELEASE; | |
const artifactName1 = `libs-${release}-${target}-1`; | |
const artifactName2 = `libs-${release}-${target}-2`; | |
const artifactName3 = `libs-${release}-${target}-3`; | |
const artifactNamesToDownload = new Set([artifactName1, artifactName2, artifactName3]); | |
let count = 0; | |
const max = 3; | |
for (const artifact of artifacts.data.artifacts) { | |
const isArtifactMatch = artifact.name.includes(`libs-${release}-${target}`) && !artifact.expired; | |
if (isArtifactMatch) { | |
const download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: artifact.id, | |
archive_format: 'zip', | |
}); | |
const artifactPath = path.join(outputDir, `${artifact.name}.zip`); | |
fs.writeFileSync(artifactPath, Buffer.from(download.data)); | |
console.log(`Downloaded ${artifact.name} to ${artifactPath}`); | |
count++; | |
if (count >= max) { | |
break; | |
} | |
} | |
} | |
- name: Extract Artifacts to /out | |
if: env.USE_ARTIFACT == 'true' | |
run: | | |
mkdir -p out | |
if ls out/*.zip 1> /dev/null 2>&1; then | |
for zip in out/*.zip; do | |
echo "Extracting $zip..." | |
unzip -o "$zip" -d out/ | |
done | |
echo "Extraction complete." | |
rm out/*.zip | |
else | |
echo "No zip files to extract." | |
fi | |
if ls out/*.tar.bz2 1> /dev/null 2>&1; then | |
for tarball in out/*.tar.bz2; do | |
echo "Extracting $tarball..." | |
tar -xjf "$tarball" -C out/ | |
done | |
echo ".tar.bz2 extraction complete." | |
rm -f out/*.tar.bz2 | |
else | |
echo "No .tar.bz2 files to extract." | |
fi | |
rm -f xout/*.tar.bz2 | |
rm -f out/*.tar.bz2 | |
- name: List output directory1 | |
run: ls -lah out/ | |
- name: Build macOS x86_64 | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/build.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
ARCH: x86_64 | |
- name: Build macOS arm64 | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/build.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
ARCH: arm64 | |
- name: List output directory | |
run: ls -lah out/ | |
- name: Cleanup out of bundle | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/artifact/artifact-clean.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
- name: List output directory2 | |
run: ls -lah out/ | |
- name: Package Binaries for Artifact | |
if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding' || contains(github.ref, 'refs/tags/')) | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/artifact/artifact.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
GA_CI_SECRET: ${{ secrets.CI_SECRET }} | |
- name: Upload binaries as Artifact | |
if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding' || contains(github.ref, 'refs/tags/')) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs-${{ env.RELEASE }}-${{ env.TARGET }}-${{ matrix.bundle }} | |
path: out/openFrameworksLibs_${{ env.RELEASE }}_${{ env.TARGET }}_${{ matrix.bundle }}.tar.bz2 | |
retention-days: 31 | |
- name: Remove .tar.bz2 files | |
if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding' || contains(github.ref, 'refs/tags/')) | |
run: | | |
echo "Removing .tar.bz2 files from out/ directory..." | |
rm -f out/*.tar.bz2 | |
rm -f xout/*.tar.bz2 | |
echo "Cleanup complete." | |
- name: Merge our libraries into XC Framework | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/osx/xcframework_all.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
- name: Package final | |
if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding' || contains(github.ref, 'refs/tags/')) | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/package.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
- name: Update Release XCFramework | |
if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding') | |
uses: softprops/action-gh-release@v2.1.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ env.RELEASE }} | |
release: ${{ env.RELEASE }} | |
files: xout/openFrameworksLibs_${{ env.RELEASE }}_${{ env.TARGET }}_${{ matrix.bundle }}.tar.bz2 |