Apothecary fixes #509
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-vs2022-64 | |
on: | |
push: | |
paths-ignore: | |
- '**/*.md' | |
pull_request: | |
paths-ignore: | |
- '**/*.md' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
TARGET: "vs" | |
ARCH: 64 | |
NO_FORCE: 1 | |
VS_VER: 17 | |
GA_CI_SECRET: ${{ secrets.CI_SECRET }} | |
USE_ARTIFACT: true | |
jobs: | |
build-vs2022: | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
bundle: [1,2] | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Setup msys2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: >- | |
base-devel | |
unzip | |
dos2unix | |
gperf | |
git | |
python3 | |
mingw-w64-x86_64-binutils | |
mingw-w64-x86_64-clang | |
mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-gcc-libs | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-gdb | |
mingw-w64-x86_64-make | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- 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 | |
- name: 'Download artifacts' | |
uses: actions/github-script@v7 | |
if: env.USE_ARTIFACT == 'true' | |
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 target = process.env.TARGET; | |
const arch = process.env.ARCH; | |
const bundle = process.env.MATRIX_BUNDLE; | |
const artifactName = `libs-${target}-${arch}-${bundle}`; | |
let count = 0; | |
const max = 1; | |
for (const artifact of artifacts.data.artifacts) { | |
if (artifact.name === artifactName && !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 | |
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: Build64 | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: scripts/build.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
- name: Package | |
if: (github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding')) | |
working-directory: ${{ env.GITHUB_WORKSPACE }} | |
run: scripts/package.sh | |
env: | |
BUNDLE: ${{ matrix.bundle }} | |
- name: Upload binaries as Artifact | |
if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bleeding') | |
uses: actions/upload-artifact@v4 | |
env: | |
release: ${{ env.RELEASE }} | |
with: | |
name: libs-${{ env.TARGET }}-${{ env.ARCH }}-${{ matrix.bundle }} | |
path: out/openFrameworksLibs_${{ env.RELEASE }}_${{ env.TARGET }}_${{ env.ARCH }}_${{ matrix.bundle }}.zip | |
retention-days: 31 | |
- name: Update Release 64 | |
if: (github.repository == 'openframeworks/apothecary' && github.event_name == 'push' && (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: out/openFrameworksLibs_${{ env.RELEASE }}_${{ env.TARGET }}_${{ env.ARCH }}_${{ matrix.bundle }}.zip | |