-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from gerlero/pixi
Switch to Pixi for dependency bundling
- Loading branch information
Showing
17 changed files
with
1,737 additions
and
368 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,6 @@ on: | |
type: string | ||
default: '' | ||
required: false | ||
deps-kind: | ||
type: string | ||
default: '' | ||
required: false | ||
cache-build: | ||
type: boolean | ||
default: true | ||
|
@@ -56,15 +52,6 @@ on: | |
default: '' | ||
required: false | ||
description: Build this OpenFOAM Git branch | ||
deps-kind: | ||
type: choice | ||
required: false | ||
description: Bundle dependencies in this manner | ||
options: | ||
- '' | ||
- standalone | ||
- bundled | ||
- homebrew | ||
cache-build: | ||
type: boolean | ||
default: true | ||
|
@@ -77,88 +64,40 @@ env: | |
${{ inputs.app-version != '' && format('APP_VERSION={0}', inputs.app-version) || '' }} | ||
${{ inputs.app-name != '' && format('APP_NAME={0}', inputs.app-name) || '' }} | ||
${{ inputs.openfoam-git-branch != '' && format('OPENFOAM_GIT_BRANCH={0}', inputs.openfoam-git-branch) || '' }} | ||
${{ inputs.deps-kind != '' && format('DEPS_KIND={0}', inputs.deps-kind) || '' }} | ||
OPENFOAM: ${{ inputs.openfoam-version || inputs.openfoam-git-branch }} | ||
|
||
jobs: | ||
deps: | ||
build: | ||
runs-on: ${{ inputs.build-os }} | ||
outputs: | ||
deps-key: ${{ steps.keys.outputs.deps-key }} | ||
build-key: ${{ steps.keys.outputs.build-key }} | ||
steps: | ||
- name: Use Xcode Command Line Tools | ||
run: sudo xcode-select --switch /Library/Developer/CommandLineTools | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Pixi | ||
uses: prefix-dev/[email protected] | ||
- name: Prepare caching | ||
run: | | ||
make deps --dry-run ${{ env.MAKE_VARS }} > make_deps.txt | ||
make build --dry-run ${{ env.MAKE_VARS }} > make_build.txt | ||
brew update | ||
brew bundle list | xargs -I {} sh -c 'brew info {} | head -n 1' > brew_versions.txt | ||
brew deps --union $(brew bundle list) | xargs -I {} sh -c 'brew info {} | head -n 1' >> brew_versions.txt | ||
sort -u -o brew_versions.txt brew_versions.txt | ||
cat brew_versions.txt | ||
- name: Generate caching keys | ||
id: keys | ||
run: | | ||
deps_key="build-${{ env.OPENFOAM }}-${{ inputs.build-os }}-${{ hashFiles('make_deps.txt', 'Brewfile', 'scripts/bundle_deps.py', 'brew_versions.txt') }}" | ||
build_key="$deps_key-${{ hashFiles('make_build.txt', 'scripts/configure.sh', 'scripts/relativize_install_names.py') }}" | ||
echo "deps-key=$deps_key" >> "$GITHUB_OUTPUT" | ||
echo "build-key=$build_key" >> "$GITHUB_OUTPUT" | ||
- name: Look up cached deps | ||
id: cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: build/*.sparsebundle | ||
key: ${{ steps.keys.outputs.build-key }} | ||
restore-keys: ${{ steps.keys.outputs.deps-key }} | ||
lookup-only: true | ||
- name: Make deps | ||
if: steps.cache.outputs.cache-matched-key == '' | ||
run: | | ||
make deps ${{ env.MAKE_VARS }} | ||
- name: Save deps to cache | ||
if: steps.cache.outputs.cache-matched-key == '' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: build/*.sparsebundle | ||
key: ${{ steps.keys.outputs.deps-key }} | ||
|
||
build: | ||
needs: deps | ||
runs-on: ${{ inputs.build-os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
pixi run make build --dry-run ${{ env.MAKE_VARS }} > make_build.txt | ||
- name: Restore cached build or deps | ||
id: cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: build/*.sparsebundle | ||
key: ${{ needs.deps.outputs.build-key }} | ||
restore-keys: | | ||
${{ needs.deps.outputs.deps-key }} | ||
fail-on-cache-miss: true | ||
key: build-${{ env.OPENFOAM }}-${{ runner.arch }}-${{ hashFiles('make_build.txt', 'pixi.lock', 'configure.sh') }} | ||
- name: Build | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
hdiutil attach build/*.sparsebundle | ||
make --touch deps ${{ env.MAKE_VARS }} | ||
make build ${{ env.MAKE_VARS }} | ||
pixi run make build ${{ env.MAKE_VARS }} | ||
- name: Save build to cache | ||
if: steps.cache.outputs.cache-hit != 'true' && inputs.cache-build | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: build/*.sparsebundle | ||
key: ${{ needs.deps.outputs.build-key }} | ||
key: ${{ steps.cache.outputs.cache-primary-key }} | ||
- name: Make app | ||
run: | | ||
hdiutil attach build/*.sparsebundle | ||
make --touch build ${{ env.MAKE_VARS }} | ||
make zip ${{ env.MAKE_VARS }} | ||
touch -c build/*.sparsebundle | ||
pixi run make zip ${{ env.MAKE_VARS }} | ||
- name: Upload app artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -181,15 +120,8 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
cache: pip | ||
- name: Install Homebrew dependencies | ||
if: inputs.deps-kind == 'homebrew' | ||
run: | | ||
brew bundle | ||
- name: Set up Pixi | ||
uses: prefix-dev/[email protected] | ||
- name: Download app artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -201,6 +133,6 @@ jobs: | |
working-directory: build | ||
- name: Test | ||
run: | | ||
make test ${{ env.MAKE_VARS }} | ||
pixi run make test ${{ env.MAKE_VARS }} | ||
env: | ||
PRTE_MCA_rmaps_default_mapping_policy: ':oversubscribe' |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Update lockfiles | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: 0 5 1 * * | ||
|
||
jobs: | ||
pixi-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up pixi | ||
uses: prefix-dev/[email protected] | ||
with: | ||
run-install: false | ||
- name: Update lockfiles | ||
run: | | ||
set -o pipefail | ||
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Update pixi lockfile | ||
title: Update pixi lockfile | ||
body-path: diff.md | ||
branch: update-pixi | ||
base: main | ||
labels: pixi | ||
delete-branch: true | ||
add-paths: pixi.lock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/build | ||
Brewfile.lock.json | ||
*.tgz | ||
.pixi | ||
/environment.tar | ||
__pycache__ | ||
.DS_Store | ||
venv |
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
Oops, something went wrong.