Skip to content

Commit

Permalink
Merge pull request #288 from gerlero/pixi
Browse files Browse the repository at this point in the history
Switch to Pixi for dependency bundling
  • Loading branch information
gerlero authored Oct 16, 2024
2 parents 1f634dc + b3771a5 commit d148147
Show file tree
Hide file tree
Showing 17 changed files with 1,737 additions and 368 deletions.
5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,3 @@ updates:
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "/tests"
schedule:
interval: "weekly"
92 changes: 12 additions & 80 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ on:
type: string
default: ''
required: false
deps-kind:
type: string
default: ''
required: false
cache-build:
type: boolean
default: true
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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'
12 changes: 0 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,13 @@ on:
pull_request:
branches:
- main
schedule:
- cron: '0 6 * * 5'
workflow_call:
inputs:
app-version:
type: string
required: true
workflow_dispatch:
inputs:
deps-kind:
type: choice
required: false
description: Bundle dependencies in this manner
options:
- ''
- standalone
- bundled
- homebrew
cache-build:
type: boolean
default: true
Expand All @@ -43,5 +32,4 @@ jobs:
build-os: ${{ matrix.build-os }}
openfoam-version: ${{ matrix.openfoam-version }}
app-version: ${{ inputs.app-version }}
deps-kind: ${{ inputs.deps-kind }}
cache-build: ${{ github.event_name == 'workflow_dispatch' && inputs.cache-build || github.event_name != 'workflow_dispatch' }}
11 changes: 0 additions & 11 deletions .github/workflows/openfoam-dev-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ on:
schedule:
- cron: '0 6 * * 5'
workflow_dispatch:
inputs:
deps-kind:
type: choice
required: false
description: Bundle dependencies in this manner
options:
- ''
- standalone
- bundled
- homebrew

jobs:
openfoam-dev-branch:
Expand All @@ -28,5 +18,4 @@ jobs:
app-name: OpenFOAM-${{ matrix.openfoam-git-branch }}
app-version: ${{ matrix.openfoam-git-branch }}
openfoam-git-branch: ${{ matrix.openfoam-git-branch }}
deps-kind: ${{ inputs.deps-kind }}
cache-build: false
36 changes: 36 additions & 0 deletions .github/workflows/update-lockfiles.yml
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
5 changes: 3 additions & 2 deletions .gitignore
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
17 changes: 0 additions & 17 deletions Brewfile

This file was deleted.

2 changes: 1 addition & 1 deletion Contents/Resources/etc/openfoam
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ volume=$("$app_bundle/Contents/Resources/volume" -show-prefix)
# Keep the volume directory open in this process (prevents accidental ejection)
exec {fd}<"$volume"

PATH="$volume/usr/opt/bash/bin${PATH+:$PATH}" exec bash "$volume/etc/openfoam" "$@"
PATH="$volume/env/bin${PATH+:$PATH}" exec bash "$volume/etc/openfoam" "$@"
Loading

0 comments on commit d148147

Please sign in to comment.