-
Notifications
You must be signed in to change notification settings - Fork 20
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 #200 from NSLS-II/fix-osx-compilation
Fix OSX compilation
- Loading branch information
Showing
6 changed files
with
144 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,145 @@ | ||
name: CI-Test | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
release: | ||
types: [published, created] | ||
|
||
jobs: | ||
|
||
lint: | ||
# pull requests are a duplicate of a branch push if within the same repo. | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
- uses: pre-commit/[email protected] | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
- uses: pre-commit/[email protected] | ||
|
||
test: | ||
# pull requests are a duplicate of a branch push if within the same repo. | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | ||
|
||
name: Tests | ||
runs-on: ${{ matrix.host-os }} | ||
needs: lint | ||
|
||
strategy: | ||
matrix: | ||
# host-os: ["ubuntu-latest", "macos-13", "macos-14"] | ||
host-os: ["ubuntu-latest"] | ||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
fail-fast: false | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- name: Set env.REPOSITORY_NAME # just the repo, as opposed to org/repo | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set env vars | ||
run: | | ||
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} | ||
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo | ||
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
python_version="${{ matrix.python-version }}" | ||
export PYTHON_VERSION_NODOT="${python_version//\./}" | ||
echo "PYTHON_VERSION_NODOT=${PYTHON_VERSION_NODOT}" >> $GITHUB_ENV | ||
- name: Set MacOS Deployment Target | ||
if: runner.os == 'macOS' | ||
run: | | ||
export MACOSX_DEPLOYMENT_TARGET="10.15" | ||
echo "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" >> $GITHUB_ENV | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
- name: Install micromamba with build dependencies | ||
uses: mamba-org/setup-micromamba@v1 | ||
# if: runner.os == 'macOS' | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
init-shell: bash | ||
environment-name: build-env | ||
create-args: >- | ||
python=${{ matrix.python-version }} | ||
arpack=*=mpi_openmpi* | ||
gfortran | ||
openmpi=4 | ||
# - name: Set up Python ${{ matrix.python-version }} | ||
# # if: matrix.host-os != 'macos-latest' | ||
# if: runner.os != 'macOS' | ||
# uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install MacOS dependencies | ||
if: runner.os == 'macOS' | ||
run: | | ||
set -vxeuo pipefail | ||
brew install tree | ||
# python -m pip install delocate | ||
|
||
- name: Install dependencies | ||
run: | | ||
set -vxeuo pipefail | ||
bash ./scripts/install-deps.sh | ||
tree . | ||
ls -Al . | ||
ls -Al ./dist/ | ||
tree . | ||
# - name: Delocate wheels for MacOS | ||
# if: runner.os == 'macOS' | ||
# run: | | ||
# set -vxeuo pipefail | ||
# delocate-wheelpython -v ./dist/${{ env.REPOSITORY_NAME }}-*-cp${PYTHON_VERSION_NODOT}*.whl | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.REPOSITORY_NAME }}-wheels | ||
path: dist/*.whl | ||
path: dist/* | ||
|
||
- name: Test with pytest | ||
run: | | ||
set -vxeuo pipefail | ||
bash ./scripts/run-tests.sh | ||
docs: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
needs: test | ||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Set env.REPOSITORY_NAME # just the repo, as opposed to org/repo | ||
run: | | ||
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} | ||
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
set -vxeuo pipefail | ||
bash ./scripts/install-deps.sh | ||
- name: Build Docs | ||
run: | | ||
set -vxeuo pipefail | ||
bash ./scripts/build-docs.sh | ||
- uses: actions/upload-artifact@v3 | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.REPOSITORY_NAME }}-docs | ||
name: ${{ env.REPOSITORY_NAME }}-${{ matrix.python-version }}-${{ matrix.host-os }}-docs | ||
path: docs/build/html/ | ||
|
||
|
||
publish-to-pypi: | ||
# Hints from: | ||
# - https://github.com/pypa/gh-action-pypi-publish/discussions/28 | ||
# - https://github.com/Lightning-AI/lightning/blob/master/.github/workflows/release-pypi.yml | ||
if: github.event_name == 'release' | ||
name: Publish to PyPI | ||
needs: test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download wheels from GitHub artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist/ | ||
|
||
- name: Publish wheels to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: ./dist/ |
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 |
---|---|---|
|
@@ -100,3 +100,6 @@ target/ | |
|
||
#Ipython Notebook | ||
.ipynb_checkpoints | ||
|
||
# cibuildwheel artifacts | ||
wheelhouse/ |
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
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