build-package #445
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: Build Ska Package | |
# This workflow builds a Ska package and optionally uploads it to a ska3-conda channel. | |
# It takes the following arguments: | |
# | |
# - package: the name of the package to build | |
# - tag: the tag to use for the package | |
# - arch: whether to build it for all architectures or as noarch (default is false) | |
# - upload: whether to upload the package to the ska3-conda channel (default is false) | |
# - python_version: the python version to use for the build (default is 3.11) | |
# - numpy_version: the numpy version to use for the build (default is 1.26.2) | |
# - channel_in: the channel to use for the build environment (default is flight). | |
# This channel gets passed to package_build workflow, which also adds conda-forge | |
# - channel_out: the channel to upload the package to (default is test) | |
# - skare3_branch: the branch of skare3 to use for the build (default is master) | |
# | |
# You call it like this: | |
# from skare3_tools import github | |
# repo = github.Repository("sot/skare3") | |
# repo.dispatch_event( | |
# "build-package", | |
# client_payload={ | |
# "package": "sot/ska_helpers", | |
# "tag": '0.13.0', | |
# "arch": False, | |
# "upload": True | |
# } | |
# ) | |
on: | |
repository_dispatch: | |
types: | |
- build-package | |
jobs: | |
# this job checks the arguments, sets defaults, and writes a summary | |
arguments: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Parse Arguments | |
id: argument_parser | |
uses: skare3/check-arguments@main | |
with: | |
arguments: | | |
- name: package_name | |
default: ${{ github.event.client_payload.package_name }} | |
- name: tag | |
default: ${{ github.event.client_payload.tag }} | |
- name: noarch | |
type: boolean | |
default: ${{ github.event.client_payload.noarch }} | |
- name: python_version | |
default: ${{ github.event.client_payload.python_version }} | |
- name: numpy_version | |
default: ${{ github.event.client_payload.numpy_version }} | |
- name: miniconda_version | |
default: ${{ github.event.client_payload.miniconda_version }} | |
- name: skare3_branch | |
default: ${{ github.event.client_payload.skare3_branch }} | |
- name: channel | |
default: ${{ github.event.client_payload.channel }} | |
- name: platform | |
default: ${{ github.event.client_payload.platform }} | |
- shell: bash -l {0} | |
run: | | |
echo "ALL ARGS: ${{ toJson(steps.argument_parser.outputs.arguments) }}" | |
echo "package_name: ${{ fromJson(steps.argument_parser.outputs.arguments).package_name }}" | |
echo "tag: ${{ fromJson(steps.argument_parser.outputs.arguments).tag }}" | |
echo "noarch: ${{ fromJson(steps.argument_parser.outputs.arguments).noarch }}" | |
echo "python_version: ${{ fromJson(steps.argument_parser.outputs.arguments).python_version }}" | |
echo "numpy_version: ${{ fromJson(steps.argument_parser.outputs.arguments).numpy_version }}" | |
echo "miniconda_version: ${{ fromJson(steps.argument_parser.outputs.arguments).miniconda_version }}" | |
echo "skare3_branch: ${{ fromJson(steps.argument_parser.outputs.arguments).skare3_branch }}" | |
echo "channel: ${{ fromJson(steps.argument_parser.outputs.arguments).channel }}" | |
echo "platform: ${{ fromJson(steps.argument_parser.outputs.arguments).platform }}" | |
echo "## Arguments:" >> $GITHUB_STEP_SUMMARY | |
echo "package_name: ${{ fromJson(steps.argument_parser.outputs.arguments).package_name }}" >> $GITHUB_STEP_SUMMARY | |
echo "tag: ${{ fromJson(steps.argument_parser.outputs.arguments).tag }}" >> $GITHUB_STEP_SUMMARY | |
echo "noarch: ${{ fromJson(steps.argument_parser.outputs.arguments).noarch }}" >> $GITHUB_STEP_SUMMARY | |
echo "python_version: ${{ fromJson(steps.argument_parser.outputs.arguments).python_version }}" >> $GITHUB_STEP_SUMMARY | |
echo "numpy_version: ${{ fromJson(steps.argument_parser.outputs.arguments).numpy_version }}" >> $GITHUB_STEP_SUMMARY | |
echo "miniconda_version: ${{ fromJson(steps.argument_parser.outputs.arguments).miniconda_version }}" >> $GITHUB_STEP_SUMMARY | |
echo "skare3_branch: ${{ fromJson(steps.argument_parser.outputs.arguments).skare3_branch }}" >> $GITHUB_STEP_SUMMARY | |
echo "channel: ${{ fromJson(steps.argument_parser.outputs.arguments).channel }}" >> $GITHUB_STEP_SUMMARY | |
echo "platform: ${{ fromJson(steps.argument_parser.outputs.arguments).platform }}" >> $GITHUB_STEP_SUMMARY | |
# build: | |
# runs-on: ubuntu-latest | |
# needs: arguments # this job needs the arguments job because it uses the outputs | |
# steps: | |
# - name: Build | |
# uses: skare3/build@alpha | |
# with: | |
# package_name: ${{ github.event.client_payload.package }} | |
# tag: ${{ github.event.client_payload.tag }} | |
# noarch: ${{ !github.event.client_payload.arch && (github.event.client_payload.arch != 'true') && (github.event.client_payload.arch != 'True')}} | |
# #python_version: ${{ needs.arguments.outputs.python_version }} | |
# #numpy_version: ${{ needs.arguments.outputs.numpy_version }} | |
# #skare3_branch: ${{ needs.arguments.outputs.skare3_branch }} | |
# # the following channel in ska3-conda is used to create the build environment | |
# #channel: ${{ needs.arguments.outputs.channel_in }} | |
# CONDA_PASSWORD: ${{ secrets.CONDA_PASSWORD }} | |
# git_token: ${{ secrets.GITHUB_TOKEN }} | |
# platform: ubuntu-latest | |
# upload: | |
# if: ${{ github.event.client_payload.upload == 'true' }} | |
# needs: [build, arguments] # this job needs the arguments job because it uses the outputs | |
# uses: sot/upload | |
# with: | |
# # this is the destination ska3-conda channel | |
# channel: ${{ needs.arguments.outputs.channel_out }} |