Skip to content

Commit

Permalink
Merge branch 'develop' into feature/gulmc
Browse files Browse the repository at this point in the history
  • Loading branch information
mtazzari committed Nov 7, 2022
2 parents 28e5209 + e0b0639 commit 50517c6
Show file tree
Hide file tree
Showing 12 changed files with 911 additions and 47 deletions.
163 changes: 163 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: Oasislmf Build

on:
workflow_dispatch:
inputs:
ktools_branch:
description: 'If set, build ktools from scratch and use output to build package: [Branch, commit]'
required: false
default: ""
build_osx:
description: 'If set, build ktools from scratch and use output to build package: [true, false]'
required: false
default: "false"

workflow_call:
inputs:
ktools_branch:
description: 'If set, build ktools from scratch and use output to build package: [Branch, commit]'
required: false
default: ""
type: string
build_osx:
description: 'If set, build ktools from scratch and use output to build package: [true, false]'
required: false
default: "false"
type: string

outputs:
src_pkg_filename:
description: "Source package filename"
value: ${{ jobs.oasislmf.outputs.src_pkg_filename }}
linux_pkg_filename:
description: "Linux package filename"
value: ${{ jobs.oasislmf.outputs.linux_pkg_filename }}
osx_pkg_filename:
description: "OSX package filename"
value: ${{ jobs.oasislmf.outputs.osx_pkg_filename }}

jobs:
ktools:
if: inputs.ktools_branch != ''
uses: OasisLMF/ktools/.github/workflows/build.yml@master
secrets: inherit
with:
create_ktools_builder: 'false'
skip_cmake: 'true'
ktools_branch: ${{ inputs.ktools_branch }}

oasislmf:
if: ${{ ! failure() || ! cancelled() }}
needs: [ktools]
runs-on: ubuntu-latest
outputs:
src_pkg_filename: ${{ steps.package_src.outputs.filename }}
linux_pkg_filename: ${{ steps.linux_whl.outputs.filename }}
osx_pkg_filename: ${{ steps.darwin_whl.outputs.filename }}
steps:
- name: Dump github context
run: echo "$GITHUB_CONTEXT"
shell: bash
env:
GITHUB_CONTEXT: ${{ toJson(github) }}

- uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- run: pip install pip-tools


# --- Ktools setup and download --- #

# With this option set the package build will install local ktools binary tarballs
# stored in `KTOOLS_TAR_FILE_DIR`, rather than trying to pull a release using
# the pinned version tag in setup.py
- name: Set local ktools tar dir
if: inputs.ktools_branch != ''
run: |
echo "KTOOLS_TAR_FILE_DIR=${{ github.workspace }}" >> $GITHUB_ENV
- name: Download ktools build (Linux)
if: inputs.ktools_branch != ''
uses: actions/download-artifact@v3
with:
name: Linux_x86_64
path: ${{ github.workspace }}/

- name: Download ktools build (Darwin)
if: inputs.ktools_branch != ''
uses: actions/download-artifact@v3
with:
name: Darwin_x86_64
path: ${{ github.workspace }}/


# --- Source Distribution --- #
- name: Build - source distribution
run: |
python setup.py sdist
TAR_PKG=$(find ./dist/ -name "oasislmf-*.tar.gz")
echo "PKG_SRC_PATH=${TAR_PKG}" >> $GITHUB_ENV
- name: Store - source distribution
uses: actions/upload-artifact@v3
with:
name: oasislmf-source-pkg
path: ${{ env.PKG_SRC_PATH }}
retention-days: 5

- name: Filename - source distribution
id: package_src
run: |
FILENAME=$(find ./dist/ -name "oasislmf-*.tar.gz" -exec basename {} \;)
echo "filename=$FILENAME" >> $GITHUB_OUTPUT
# --- Linux Distribution --- #
- name: Build - binary distribution (Linux)
run: |
python setup.py bdist_wheel --plat-name Linux_x86_64
WHL_LINUX=$(find ./dist/ -name "oasislmf-*manylinux1_x86_64.whl")
echo "PKG_LINUX_PATH=${WHL_LINUX}" >> $GITHUB_ENV
- name: Store - binary distribution (Linux)
uses: actions/upload-artifact@v3
with:
name: oasislmf-bin-pkg_linux
path: ${{ env.PKG_LINUX_PATH }}
retention-days: 5

- name: Filename - binary distribution (Linux)
id: linux_whl
run: |
FILENAME=$(find ./dist/ -name "oasislmf-*manylinux1_x86_64.whl" -exec basename {} \;)
echo "filename=$FILENAME" >> $GITHUB_OUTPUT
## --- Darwin Distribution --- #
- name: Build - binary distribution (Darwin)
if: inputs.build_osx == 'true' || inputs.ktools_branch != ''
run: |
python setup.py bdist_wheel --plat-name Darwin_x86_64
WHL_OSX=$(find ./dist/ -name "oasislmf-*macosx_10_6_intel.whl")
echo "PKG_DARWIN_PATH=${WHL_OSX}" >> $GITHUB_ENV
- name: Store - binary distribution (Darwin)
if: inputs.build_osx == 'true' || inputs.ktools_branch != ''
uses: actions/upload-artifact@v3
with:
name: oasislmf-bin-pkg_darwin
path: ${{ env.PKG_DARWIN_PATH }}
retention-days: 5

- name: Filename - binary distribution (Darwin)
if: inputs.build_osx == 'true' || inputs.ktools_branch != ''
id: darwin_whl
run: |
FILENAME=$(find ./dist/ -name "oasislmf-*macosx_10_6_intel.whl" -exec basename {} \;)
echo "osx_pkg=$FILENAME" >> $GITHUB_OUTPUT
114 changes: 114 additions & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Slack Message

on:
workflow_call:
inputs:
heading:
description: 'Slack text block heading'
required: true
default: ""
type: string
title:
description: 'Title of build message'
required: true
default: ""
type: string
build_branch:
description: 'Branch which build ran on'
required: true
default: ""
type: string
run_url:
description: 'URL for Github actions run'
required: true
default: ""
type: string
run_id:
description: 'run ID of workflow run'
required: true
default: ""
type: string
run_status:
description: 'Status of run'
required: true
default: ""
type: string
run_date:
description: 'Date run was executed on'
required: true
default: ""
type: string

workflow_dispatch:
inputs:
heading:
description: 'Slack text block heading'
required: true
default: ""
title:
description: 'Title of build message'
required: true
default: ""
build_branch:
description: 'Branch which build ran on'
required: true
default: ""
run_url:
description: 'URL for Github actions run'
required: true
default: ""
run_id:
description: 'run ID of workflow run'
required: true
default: ""
run_status:
description: 'Status of run'
required: true
default: ""
run_date:
description: 'Date run was executed on'
required: true
default: ""


jobs:
notify:
runs-on: ubuntu-latest
strategy:
matrix:
channel: [oasis, members] #Array of slack channels
include:
- channel: oasis
webhook_secret: SLACK_WEBHOOK_URL_OASIS
- channel: members
webhook_secret: SLACK_WEBHOOK_URL_MEMBERS

steps:
- name: Send slack message
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
# For posting a rich message using Block Kit
payload: |
{
"text": "${{ inputs.heading }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ inputs.title }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": " *build branch:* ${{ inputs.build_branch }} \n *workflow run:* <${{ inputs.run_url }}| Build ${{ inputs.run_id }}> \n *build result:* ${{ inputs.run_status }} \n *date:* ${{ inputs.run_date }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets[matrix.webhook_secret] }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
27 changes: 27 additions & 0 deletions .github/workflows/piwind-mdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PiWind MDK

on:
push:
workflow_dispatch:
inputs:
build_branch:
description: 'Branch of build script repo - https://github.com/OasisLMF/build'
required: true
default: master
piwind_branch:
description: 'Branch to run PiWind from'
required: true
default: develop
mdk_run_type:
description: 'Loss modes to test, options are one of "[gul, il, ri]"'
required: true
default: ri

jobs:
PiWind:
uses: OasisLMF/OasisPiWind/.github/workflows/run_mdk.yml@master
with:
build_branch: ${{ github.event_name == 'push' && 'master' || inputs.build_branch }}
mdk_branch: ${{ github.ref_name }}
mdk_run_type: ${{ github.event_name == 'push' && 'ri' || inputs.mdk_run_type }}
piwind_branch: ${{ github.event_name == 'push' && 'develop' || inputs.piwind_branch }}
32 changes: 32 additions & 0 deletions .github/workflows/piwind-results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PiWind check output

on:
push:
workflow_dispatch:
inputs:
build_branch:
description: 'Branch of build script repo - https://github.com/OasisLMF/build'
required: true
default: master
platform_version:
description: 'OasisPlatform Version to test using'
required: true
default: latest
piwind_branch:
description: 'Branch to run PiWind from'
required: true
default: develop
build_worker:
description: 'Build new worker based on "mdk_branch" value'
required: true
default: true

jobs:
PiWind:
uses: OasisLMF/OasisPiWind/.github/workflows/check_results.yml@master
with:
build_branch: ${{ github.event_name == 'push' && 'master' || inputs.build_branch }}
platform_version: ${{ github.event_name == 'push' && 'latest' || inputs.platform_version }}
piwind_branch: ${{ github.event_name == 'push' && 'develop' || inputs.piwind_branch }}
build_worker: ${{ github.event_name == 'push' && 'true' || inputs.build_worker }}
mdk_branch: ${{ github.ref_name }}
Loading

0 comments on commit 50517c6

Please sign in to comment.