Skip to content

Merge remote-tracking branch 'upstream/main' #5

Merge remote-tracking branch 'upstream/main'

Merge remote-tracking branch 'upstream/main' #5

Workflow file for this run

# This workflow uploads the `openfast` python package to PyPI before building an OpenFAST docker image for the
# linux/amd64 and linux/aarch64 architectures on release. The image is tagged both with "latest" and the version
# extracted from the release candidate branch's name (e.g. "rc-3.5.3") before being pushed to the `nrel/openfast`
# repository. The build cache is stored in GitHub actions.
name: deploy
on:
workflow_dispatch:
release:
types:
- released
push:
paths-ignore:
- 'LICENSE'
- 'README.rst'
- 'docs/**'
- 'share/**'
jobs:
# Disabled as publish-to-pypi is working correctly
publish-to-pypi-test:
runs-on: ubuntu-latest
if: false
# if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install Hatch
uses: pypa/hatch@install
- name: Install dependencies
run: pip install keyring[file]
- name: Build package
run: hatch build
working-directory: openfast_io
- name: Publish to PyPI test
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TEST_TOKEN }}
run: hatch publish -r test
working-directory: openfast_io
publish-to-pypi:
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install Hatch
uses: pypa/hatch@install
- name: Install dependencies
run: pip install keyring[file]
- name: Build package
run: hatch build
working-directory: openfast_io
- name: Publish to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
run: hatch publish
working-directory: openfast_io
# Disabled as it fails due to huge memory requirements
docker-build-and-push:
runs-on: ubuntu-latest
if: false
# if: github.event_name == 'release'
timeout-minutes: 500
env:
DOCKERFILE_PATH: share/docker/Dockerfile
DOCKERHUB_REPOSITORY: nrel/openfast
GH_REGISTRY: ghcr.io/openfast/openfast
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Commenting out until we get the NREL DockerHub credentials
# - name: Log in to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.GH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag from release candidate branch name
id: extract-tag
run: |
TAG="${{ github.event.release.tag_name }}"
CLEAN_TAG="${TAG#v}"
echo "openfast-tag=$CLEAN_TAG" >> $GITHUB_OUTPUT
echo "Extracted tag $CLEAN_TAG"
- name: Build and push to registry
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}
platforms: linux/amd64,linux/aarch64
tags: |
${{ env.GH_REGISTRY }}:${{ steps.extract-tag.outputs.openfast-tag }},${{ env.GH_REGISTRY }}:latest
# ${{ env.DOCKERHUB_REPOSITORY }}:${{ steps.extract-tag.outputs.openfast-tag }},${{ env.DOCKERHUB_REPOSITORY }}:latest
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-windows-executables:
runs-on: windows-2022
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Test devenv actually works
shell: cmd
run: .github/scripts/windows_devenv_test.bat
- name: Install Intel oneAPI BaseKit (Windows)
shell: cmd
env:
URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
COMPONENTS: intel.oneapi.win.mkl.devel
run: |
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
del %TEMP%\webimage.exe
webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=1 --log-dir=.
set installer_exit_code=%ERRORLEVEL%
rd /s/q "webimage_extracted"
exit /b %installer_exit_code%
- name: Install Intel oneAPI HPCKit (Windows)
shell: cmd
env:
URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/c95a3b26-fc45-496c-833b-df08b10297b9/w_HPCKit_p_2024.1.0.561_offline.exe
COMPONENTS: intel.oneapi.win.ifort-compiler
run: |
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
del %TEMP%\webimage.exe
webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=1 --log-dir=.
set installer_exit_code=%ERRORLEVEL%
rd /s/q "webimage_extracted"
exit /b %installer_exit_code%
- name: Set up MATLAB
id: setup-matlab
uses: matlab-actions/setup-matlab@v2
with:
products: Simulink
- name: Build Executables
env:
MATLAB_ROOT: ${{ steps.setup-matlab.outputs.matlabroot }}
run: .github/scripts/build_windows_executables.bat
- name: Test version output
run: |
build/bin/openfast_x64.exe -h
build/bin/TurbSim_x64.exe -h
build/bin/FAST.Farm_x64.exe -h
- name: Build MATLAB Mex File
uses: matlab-actions/run-command@v2
with:
command: |
mexname = 'FAST_SFunc';
mex('-largeArrayDims', ...
'-v', ...
['-L' fullfile('build','bin')], ...
['-I' fullfile('modules','openfast-library','src')], ... % "FAST_Library.h"
['-I' fullfile('modules','supercontroller','src')], ... % "SuperController_Types.h"
['-I' fullfile('modules','externalinflow','src')], ... % "ExternalInflow_Types.h"
['-I' fullfile('modules','extloads','src')], ... % "ExtLoadsDX_Types.h"
['-I' fullfile(matlabroot,'simulink','include')], ...
['-I' fullfile(matlabroot,'extern','include')], ...
['COMPFLAGS=$COMPFLAGS -MT -DS_FUNCTION_NAME=' mexname], ...
'-lOpenFAST-Simulink_x64', ...
'-outdir', fullfile('build','bin'), ...
'-output', mexname, ...
fullfile('glue-codes','simulink','src','FAST_SFunc.c'));
- name: Upload executables
uses: actions/upload-artifact@v4
with:
name: openfast-binaries
path: |
build/bin/*.exe
build/bin/*.dll
build/bin/*.mexw64