Skip to content

Merge pull request #1572 from HEXRD/refactor-calibration-classes #1011

Merge pull request #1572 from HEXRD/refactor-calibration-classes

Merge pull request #1572 from HEXRD/refactor-calibration-classes #1011

Workflow file for this run

name: package
on:
push:
branches: [ master ]
tags: ["*"]
pull_request:
branches: [ master ]
jobs:
build-package:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Linux",
os: ubuntu-latest,
package: 'tar.gz'
}
- {
name: "MacOSX",
os: macos-latest,
package: 'dmg'
}
- {
name: "Windows",
os: windows-latest,
package: 'msi'
}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
path: hexrdgui
- name: Install conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: '3.10'
auto-activate-base: false
- name: Get version using git describe
working-directory: hexrdgui
run: echo "HEXRDGUI_GIT_DESCRIBE=$(git describe --tag)" >> $GITHUB_ENV
- name: Set version environment variables used by CPack
working-directory: hexrdgui
run: |
python packaging/github_action_version.py ${{ env.HEXRDGUI_GIT_DESCRIBE }} full
python packaging/github_action_version.py ${{ env.HEXRDGUI_GIT_DESCRIBE }} major
python packaging/github_action_version.py ${{ env.HEXRDGUI_GIT_DESCRIBE }} minor
python packaging/github_action_version.py ${{ env.HEXRDGUI_GIT_DESCRIBE }} patch
- name: Set channel for HEXRD ( hexrd or hexrd-prerelease )
run: |
$(${{ github.event_name == 'push' }} && ${{ startsWith(github.ref, 'refs/tags/') }}) && echo "HEXRD_PACKAGE_CHANNEL=HEXRD" >> $GITHUB_ENV || echo "HEXRD_PACKAGE_CHANNEL=HEXRD/label/hexrd-prerelease" >> $GITHUB_ENV
- name: Create conda environment to build HEXRDGUI
working-directory: hexrdgui
run: |
conda env create -f packaging/environment.yml
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate
# command works.
shell: bash -l {0}
- name: Build the package using CPack
working-directory: hexrdgui/packaging
run: |
conda activate hexrdgui-package
mkdir output
HEXRD_PACKAGE_CHANNEL=${HEXRD_PACKAGE_CHANNEL} HEXRDGUI_OUTPUT_FOLDER=output/ cpack
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate
# command works.
shell: bash -l {0}
env:
CPACK_OSX_SYSROOT: "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk"
- name: Upload InstallOutput.log
if: ${{ failure() }}
uses: actions/upload-artifact@v2-preview
with:
name: InstallOutput.log
path: ${{ github.workspace }}/hexrdgui/packaging/_CPack_Packages/*/InstallOutput.log
- name: Upload WIX log ( Windows only )
if: ${{ failure() && matrix.config.os == 'windows-latest'}}
uses: actions/upload-artifact@v2-preview
with:
name: wix.log
path: ${{ github.workspace }}/hexrdgui/packaging/_CPack_Packages/WIX/wix.log
- name: Upload installer package
uses: actions/upload-artifact@v2-preview
with:
name: HEXRDGUI-v${{env.VERSION}}.${{ matrix.config.package }}
path: ${{ github.workspace }}/hexrdgui/packaging/HEXRDGUI-${{env.VERSION}}.${{ matrix.config.package }}
- name: Upload installer package Zip ( Windows only )
if: ${{ matrix.config.os == 'windows-latest'}}
uses: actions/upload-artifact@v2-preview
with:
name: HEXRDGUI-v${{env.VERSION}}.zip
path: ${{ github.workspace }}/hexrdgui/packaging/HEXRDGUI-${{env.VERSION}}.zip
- name: Upload the HEXRDGUI conda package ( PRs only )
if: github.ref != 'refs/heads/master'
uses: actions/upload-artifact@v2-preview
with:
name: HEXRDGUI-${{ matrix.config.name }}-${{ env.HEXRDGUI_GIT_DESCRIBE }}.tar.bz2
path: ${{ github.workspace }}/hexrdgui/packaging/output/**/*.tar.bz2
- name: Set label ( main or hexrdgui-prerelease )
run: |
[[ ${{ github.event_name }} = 'push' && ${{ github.ref }} = 'refs/heads/master' ]] && echo "HEXRDGUI_PACKAGE_LABEL=hexrdgui-prerelease" >> $GITHUB_ENV || echo "HEXRDGUI_PACKAGE_LABEL=main" >> $GITHUB_ENV
- name: Upload the package to anaconda channel (only on master)
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/')
working-directory: hexrdgui/packaging
run: |
conda activate hexrdgui-package
# FIXME: downgrade urllib3 until this issue is fixed:
# https://github.com/Anaconda-Platform/anaconda-client/issues/654
conda install --override-channels -c conda-forge anaconda-client 'urllib3<2.0.0'
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --force --user HEXRD --label ${HEXRDGUI_PACKAGE_LABEL} output/**/*.tar.bz2
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate
# command works.
shell: bash -l {0}