Apothecary fixes #447
Workflow file for this run
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-xcframeworks | |
on: | |
push: | |
branches: | |
- master | |
- bleeding | |
paths-ignore: | |
- '**/README.md' | |
pull_request: | |
branches: | |
- master | |
- bleeding | |
paths-ignore: | |
- '**/README.md' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
wait-for-workflows: | |
runs-on: [ubuntu-latest] | |
if: github.repository == 'openframeworks/apothecary' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding') | |
steps: | |
- name: Wait build-ios | |
uses: NathanFirmo/wait-for-other-action@v1.0.4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: 'build-ios.yml' | |
- name: Wait build-macos | |
uses: NathanFirmo/wait-for-other-action@v1.0.4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: 'build-macos.yml' | |
# - name: Wait build-xros | |
# uses: NathanFirmo/wait-for-other-action@v1.0.4 | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# workflow: 'build-xros.yml' | |
# - name: Wait build-catos | |
# uses: NathanFirmo/wait-for-other-action@v1.0.4 | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# workflow: 'build-catos.yml' | |
- name: Wait build-tvos | |
uses: NathanFirmo/wait-for-other-action@v1.0.4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: 'build-tvos.yml' | |
# - name: Wait build-watchos | |
# uses: NathanFirmo/wait-for-other-action@v1.0.4 | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# workflow: 'build-watchos.yml' | |
build-xcframework: | |
runs-on: macos-14 | |
if: github.repository == 'openframeworks/apothecary' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding') | |
needs: wait-for-workflows | |
env: | |
DEVELOPER_DIR: "/Applications/Xcode_15.4.app/Contents/Developer" | |
TARGET: "macos" | |
steps: | |
- name: Determine Release | |
id: vars | |
shell: bash | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then | |
echo "RELEASE=nightly" >> $GITHUB_ENV | |
echo "PRERELEASE=false" >> $GITHUB_ENV | |
elif [[ "${{ github.ref }}" == "refs/heads/bleeding" ]]; then | |
echo "RELEASE=bleeding" >> $GITHUB_ENV | |
echo "PRERELEASE=true" >> $GITHUB_ENV | |
else | |
echo "RELEASE=bleeding" >> $GITHUB_ENV | |
echo "PRERELEASE=true" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v4 | |
- name: Scripts Calc Formula | |
run: ./scripts/calculate_formulas.sh | |
- name: Scripts Install | |
run: ./scripts/macos/install.sh | |
- name: 'Download all artifacts' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
// https://api.github.com/repos/openframeworks/apothecary/actions/artifacts?per_page=100 | |
// Ensure the output directory exists | |
const outputDir = path.join(process.env.GITHUB_WORKSPACE, 'out'); | |
if (!fs.existsSync(outputDir)){ | |
fs.mkdirSync(outputDir); | |
} | |
// List all artifacts for the repository | |
const artifacts = await github.rest.actions.listArtifactsForRepo({ | |
owner: 'openframeworks', | |
repo: 'apothecary', | |
sort: 'created_at', | |
direction: 'desc', | |
per_page: 50 | |
}); | |
const max=9; | |
const artifactNamesToDownload = ['libs-ios-ios-1', 'libs-ios-ios-2', 'libs-ios-ios-3', | |
'libs-macos-osx-1', 'libs-macos-osx-2', 'libs-macos-osx-3', | |
'libs-tvos-tvos-1', 'libs-tvos-tvos-2', 'libs-tvos-tvos-3' | |
]; | |
let count = 0; | |
for (const artifact of artifacts.data.artifacts) { | |
if (artifactNamesToDownload.includes(artifact.name) && !artifact.expired) { | |
// Download the artifact | |
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 | |
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 directory | |
run: ls -lah ./ | |
- name: List output directory out | |
run: ls -lah ./out | |
- name: Merge built libaries into Mega XC Framework | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/macos/xcframework_all.sh | |
env: | |
GA_CI_SECRET: ${{ secrets.CI_SECRET }} | |
- name: List output directory xout | |
run: ls -lah ./xout | |
- name: Split into bundles 1 | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/macos/xcframework-split.sh macos 1 | |
- name: Split into bundles 2 | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/macos/xcframework-split.sh macos 2 | |
- name: Split into bundle 3 | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/macos/xcframework-split.sh macos 3 | |
- name: Package Final | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/package.sh macos 1 | |
env: | |
GA_CI_SECRET: ${{ secrets.CI_SECRET }} | |
- name: Package Final | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/package.sh macos 2 | |
env: | |
GA_CI_SECRET: ${{ secrets.CI_SECRET }} | |
- name: Package Final | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/package.sh macos 3 | |
env: | |
GA_CI_SECRET: ${{ secrets.CI_SECRET }} | |
- name: Update Release macOS 1 | |
if: github.repository == 'openframeworks/apothecary' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding') | |
uses: johnwbyrd/update-release@v1.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ env.RELEASE }} | |
release: ${{ env.RELEASE }} | |
prerelease: ${{ env.PRERELEASE }} | |
files: xout_1/openFrameworksLibs_${{ env.RELEASE }}_${{ env.TARGET }}_1.tar.bz2 | |
- name: Update Release macOS 2 | |
if: github.repository == 'openframeworks/apothecary' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding') | |
uses: johnwbyrd/update-release@v1.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ env.RELEASE }} | |
release: ${{ env.RELEASE }} | |
prerelease: ${{ env.PRERELEASE }} | |
files: xout_2/openFrameworksLibs_${{ env.RELEASE }}_${{ env.TARGET }}_2.tar.bz2 | |
- name: Update Release macOS 3 | |
if: github.repository == 'openframeworks/apothecary' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding') | |
uses: johnwbyrd/update-release@v1.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ env.RELEASE }} | |
release: ${{ env.RELEASE }} | |
prerelease: ${{ env.PRERELEASE }} | |
files: xout_3/openFrameworksLibs_${{ env.RELEASE }}_${{ env.TARGET }}_3.tar.bz2 |