Skip to content

Commit

Permalink
pull macos build/test workflow out
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibbelink committed May 3, 2024
1 parent 44d4925 commit 58f4d66
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 114 deletions.
114 changes: 2 additions & 112 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
workflow_dispatch:
pull_request:
paths-ignore:
- '.github/workflows/macos_build_test.yml'
- '.github/workflows/publish_latest.yml'
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
Expand All @@ -14,6 +15,7 @@ on:
- 'CHANGELOG.rst'
push:
paths-ignore:
- '.github/workflows/macos_build_test.yml'
- '.github/workflows/publish_latest.yml'
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
Expand Down Expand Up @@ -171,118 +173,6 @@ jobs:
rocky_version=${{ matrix.rocky_versions }}
build-test-macos:
strategy:
fail-fast: false
matrix:
osx_versions : [
macos-12,
macos-13,
macos-14,
]

runs-on: [ "${{ matrix.osx_versions }}" ]

steps:
- name: Checkout Cyclus
uses: actions/checkout@v4

- name: --slow flag if on ARM
if: ${{ matrix.osx_versions == 'macos-14' }}
run: |
echo "SLOW_FLAG=--slow" >> "$GITHUB_ENV"
- name: Build and Test Cyclus
id: build-cyclus
run: |
brew install \
boost \
libxml++@4 \
hdf5 \
cbc \
clp \
python3
export PATH=$(brew --prefix python3)/bin:$PATH
python3 -m pip install --target $(python -m site --user-site) \
cython \
jinja2 \
numpy \
pandas \
setuptools \
pytest \
tables
python3 install.py -j 3 --coin-root $(brew --prefix) --allow-milps ${SLOW_FLAG}
export PATH=$HOME/.local/bin:$PATH
export DYLD_LIBRARY_PATH=$HOME/.local/lib
cyclus_unit_tests
cd tests && python3 -m pytest
- name: Checkout Cycamore
if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }}
uses: actions/checkout@v4
with:
repository: cyclus/cycamore
path: ${{ github.workspace }}/cycamore

- name: Build and Test Cycamore
id: build-cycamore
if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }}
continue-on-error: true
run: |
cd ${{ github.workspace }}/cycamore
python3 install.py -j 3
export PATH=$HOME/.local/bin:$PATH
export DYLD_LIBRARY_PATH=$HOME/.local/lib
cycamore_unit_tests
cd tests && python3 -m pytest
- name: Checkout Cymetric
if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }}
uses: actions/checkout@v4
with:
repository: cyclus/cymetric
path: ${{ github.workspace }}/cymetric

- name: Build and Test Cymetric
id: build-cymetric
if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }}
continue-on-error: true
run: |
cd ${{ github.workspace }}/cymetric
python3 install.py -j 3
export PATH=$HOME/.local/bin:$PATH
export DYLD_LIBRARY_PATH=$HOME/.local/lib
cd tests && python3 -m pytest
- name: Export Environment Variables
if: github.event_name == 'pull_request'
run: |
echo "CYCAMORE_BUILD_STATUS=${{steps.build-cycamore.outcome == 'success' && '**Success** :white_check_mark:' ||
steps.build-cycamore.outcome == 'failure' && '**Failure** :x:' ||
'**Skipped due to upstream failure** :warning:'}}" >> "$GITHUB_ENV"
echo "CYMETRIC_BUILD_STATUS=${{steps.build-cymetric.outcome == 'success' && '**Success** :white_check_mark:' ||
steps.build-cymetric.outcome == 'failure' && '**Failure** :x:' ||
'**Skipped due to upstream failure** :warning:'}}" >> "$GITHUB_ENV"
echo "ARTIFACT_NAME=${{ matrix.osx_versions }}" >> "$GITHUB_ENV"
- name: Construct Artifact
if: github.event_name == 'pull_request'
run: |
echo "
##### Build \`${{ matrix.osx_versions }}\`
- Cycamore: ${{ env.CYCAMORE_BUILD_STATUS }}
- Cymetric: ${{ env.CYMETRIC_BUILD_STATUS }}" > ${{ env.ARTIFACT_NAME }}.txt
- name: Upload Artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}.txt


upload-pr-number:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
paths-ignore:
- '.github/workflows/build_test.yml'
- '.github/workflows/macos_build_test.yml'
- '.github/workflows/publish_latest.yml'
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
Expand Down
163 changes: 163 additions & 0 deletions .github/workflows/macos_build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: MacOS Build/Test Cyclus

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
paths-ignore:
- '.github/workflows/build_test.yml'
- '.github/workflows/publish_latest.yml'
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
- '.github/workflows/code_coverage.yml'
- '.github/workflows/rocky_build_test.yml'
- 'doc/**'
- 'CHANGELOG.rst'
push:
paths-ignore:
- '.github/workflows/build_test.yml'
- '.github/workflows/publish_latest.yml'
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
- '.github/workflows/code_coverage.yml'
- '.github/workflows/rocky_build_test.yml'
- 'doc/**'
- 'CHANGELOG.rst'


jobs:
build-test-macos:
strategy:
fail-fast: false
matrix:
macos_versions : [
macos-12,
macos-13,
macos-14,
]

runs-on: [ "${{ matrix.macos_versions }}" ]

steps:
- name: Checkout Cyclus
uses: actions/checkout@v4

- name: --slow flag if on ARM
if: ${{ matrix.macos_versions == 'macos-14' }}
run: |
echo "SLOW_FLAG=--slow" >> "$GITHUB_ENV"
- name: Build and Test Cyclus
id: build-cyclus
run: |
brew install \
boost \
libxml++@4 \
hdf5 \
cbc \
clp \
python3
export PATH=$(brew --prefix python3)/bin:$PATH
python3 -m pip install --target $(python -m site --user-site) \
cython \
jinja2 \
numpy \
pandas \
setuptools \
pytest \
tables
python3 install.py -j 3 --coin-root $(brew --prefix) --allow-milps ${SLOW_FLAG}
export PATH=$HOME/.local/bin:$PATH
export DYLD_LIBRARY_PATH=$HOME/.local/lib
cyclus_unit_tests
cd tests && python3 -m pytest
- name: Checkout Cycamore
if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }}
uses: actions/checkout@v4
with:
repository: cyclus/cycamore
path: ${{ github.workspace }}/cycamore

- name: Build and Test Cycamore
id: build-cycamore
if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }}
continue-on-error: true
run: |
cd ${{ github.workspace }}/cycamore
python3 install.py -j 3
export PATH=$HOME/.local/bin:$PATH
export DYLD_LIBRARY_PATH=$HOME/.local/lib
cycamore_unit_tests
cd tests && python3 -m pytest
- name: Checkout Cymetric
if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }}
uses: actions/checkout@v4
with:
repository: cyclus/cymetric
path: ${{ github.workspace }}/cymetric

- name: Build and Test Cymetric
id: build-cymetric
if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }}
continue-on-error: true
run: |
cd ${{ github.workspace }}/cymetric
python3 install.py -j 3
export PATH=$HOME/.local/bin:$PATH
export DYLD_LIBRARY_PATH=$HOME/.local/lib
cd tests && python3 -m pytest
- name: Export Environment Variables
if: github.event_name == 'pull_request'
run: |
echo "CYCAMORE_BUILD_STATUS=${{steps.build-cycamore.outcome == 'success' && '**Success** :white_check_mark:' ||
steps.build-cycamore.outcome == 'failure' && '**Failure** :x:' ||
'**Skipped due to upstream failure** :warning:'}}" >> "$GITHUB_ENV"
echo "CYMETRIC_BUILD_STATUS=${{steps.build-cymetric.outcome == 'success' && '**Success** :white_check_mark:' ||
steps.build-cymetric.outcome == 'failure' && '**Failure** :x:' ||
'**Skipped due to upstream failure** :warning:'}}" >> "$GITHUB_ENV"

echo "ARTIFACT_NAME=${{ matrix.macos_versions }}" >> "$GITHUB_ENV"

- name: Construct Artifact
if: github.event_name == 'pull_request'
run: |
echo "
##### Build \`${{ matrix.macos_versions }}\`
- Cycamore: ${{ env.CYCAMORE_BUILD_STATUS }}
- Cymetric: ${{ env.CYMETRIC_BUILD_STATUS }}" > ${{ env.ARTIFACT_NAME }}.txt
- name: Upload Artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}.txt

upload-pr-number:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout cyclus
uses: actions/checkout@v4

- name: Save PR number and Commit hash to file
run: |
echo "${{ github.event.number }}" > pr_number
echo "${{ github.event.pull_request.head.sha }} - $(git log -1 --format=%ci)" > commit_hash_timestamp
- name: Upload PR number artifact
uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number

- name: Upload Commit hash artifact
uses: actions/upload-artifact@v4
with:
name: commit_hash_timestamp
path: commit_hash_timestamp

4 changes: 2 additions & 2 deletions .github/workflows/pr_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Comment on PR

on:
workflow_run:
workflows: ["Build/Test Cyclus"]
workflows: ["Build/Test Cyclus", "MacOS Build/Test Cyclus"]
types:
- completed

Expand All @@ -28,5 +28,5 @@ jobs:
uses: thollander/actions-comment-pull-request@v2
with:
pr_number: ${{ env.PR_NUMBER }}
comment_tag: build_status_report
comment_tag: ${{ github.event.workflow_run.workflow_id }}
filePath: artifacts_merged.md

0 comments on commit 58f4d66

Please sign in to comment.