Make workflow execute correctly on Mac runners again #403
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: ποΈ Make & Test Wheels ποΈ | |
env: | |
ERT_SHOW_BACKTRACE: 1 | |
NO_PROJECT_RES: 1 | |
BOOST_VERSION: 1.84.0 | |
DAKOTA_VERSION: 6.19.0 | |
INSTALL_DIR: local | |
NEEDS_REBUILD: true | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: "v*" | |
workflow_dispatch: | |
inputs: | |
publish: | |
type: boolean | |
default: false | |
jobs: | |
build-settings: | |
runs-on: ubuntu-latest | |
outputs: # We define the globals here (reason: passing global env variables to wf inputs does not work) | |
ERT_SHOW_BACKTRACE: ${{ env.ERT_SHOW_BACKTRACE }} | |
NO_PROJECT_RES: ${{ env.NO_PROJECT_RES }} | |
BOOST_VERSION: ${{ env.BOOST_VERSION }} | |
DAKOTA_VERSION: ${{ env.DAKOTA_VERSION }} | |
INSTALL_DIR: ${{ env.INSTALL_DIR }} | |
NEEDS_REBUILD: ${{ env.NEEDS_REBUILD }} | |
steps: | |
- uses: actions/cache@v4 | |
name: Check cache for already built wheels | |
id: cache-package | |
with: | |
key: carolina_wheels_boost${{ env.BOOST_VERSION }}_dakota${{ env.DAKOTA_VERSION }} | |
path: /tmp/dist | |
- name: Write cache status to outputs | |
if: steps.cache-package.outputs.cache-hit == 'true' | |
run: | |
echo "NEEDS_REBUILD=false" >> $GITHUB_OUTPUT | |
build_macos_wheels: | |
needs: build-settings | |
if: ${{ needs.build-settings.outputs.NEEDS_REBUILD == 'true' }} | |
uses: ./.github/workflows/bundle_with_dakota_macos.yml | |
with: | |
ERT_SHOW_BACKTRACE: ${{ needs.build-settings.outputs.ERT_SHOW_BACKTRACE}} | |
NO_PROJECT_RES: ${{ needs.build-settings.outputs.NO_PROJECT_RES}} | |
BOOST_VERSION: ${{ needs.build-settings.outputs.BOOST_VERSION}} | |
DAKOTA_VERSION: ${{ needs.build-settings.outputs.DAKOTA_VERSION}} | |
INSTALL_DIR: ${{ needs.build-settings.outputs.INSTALL_DIR}} | |
secrets: inherit | |
build_linux_wheels: | |
if: ${{ needs.build-settings.outputs.NEEDS_REBUILD == 'true' }} | |
needs: build-settings | |
uses: ./.github/workflows/bundle_with_dakota_linux.yml | |
with: | |
ERT_SHOW_BACKTRACE: ${{ needs.build-settings.outputs.ERT_SHOW_BACKTRACE}} | |
NO_PROJECT_RES: ${{ needs.build-settings.outputs.NO_PROJECT_RES}} | |
BOOST_VERSION: ${{ needs.build-settings.outputs.BOOST_VERSION}} | |
DAKOTA_VERSION: ${{ needs.build-settings.outputs.DAKOTA_VERSION}} | |
INSTALL_DIR: ${{ needs.build-settings.outputs.INSTALL_DIR}} | |
secrets: inherit | |
publish_wheels: | |
needs: [ build-settings, build_macos_wheels, build_linux_wheels ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Download built artifacts" | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Create dist/ folder with all the wheels | |
run: | | |
mkdir dist | |
find artifacts -type f -name "carolina*.whl" -exec mv {} dist/ \; | |
ls dist | |
- name: Cache wheels folder | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
path: dist | |
key: carolina_wheels_boost${{ needs.build-settings.outputs.BOOST_VERSION }}_dakota${{ needs.build-settings.outputs.DAKOTA_VERSION }} | |
- uses: actions/cache/restore@v4 | |
id: restore-cached-package | |
with: | |
key: carolina_wheels_boost${{ needs.build-settings.outputs.BOOST_VERSION }}_dakota${{ needs.build-settings.outputs.DAKOTA_VERSION }} | |
path: dist | |
- name: Validate dist with twine check | |
run: | | |
ls dist | |
pip install twine | |
twine check dist/* | |
# remove carolina dev-wheels if any | |
echo "Looking for dev-wheels: matching on carolina*dev*.whl" | |
if [ -n "$(find dist . -name 'carolina*dev*.whl' -print -quit)" ]; then | |
echo "Removing dev-wheels.." | |
rm dist/carolina*dev*.whl | |
fi | |
ls dist | |
- name: Publish to pypi | |
uses: pypa/[email protected] | |
if: > | |
(github.event_name == 'workflow_dispatch' && inputs.publish) || | |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
packages-dir: dist/ | |
skip-existing: true |