Remove comma so it is not interpreted as a tuple #1430
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: 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-12, | |
package: 'dmg' | |
} | |
- { | |
name: "Windows", | |
os: windows-latest, | |
package: 'msi' | |
} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: hexrdgui | |
- name: Install conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: '3.11' | |
auto-activate-base: false | |
- name: Install EGL on Linux (PySide6 needs it) | |
if: ${{ matrix.config.name == 'Linux' }} | |
run: sudo apt-get install -y libegl1-mesa-dev | |
- 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 prerelease ) | |
run: | | |
$(${{ github.event_name == 'push' }} && ${{ startsWith(github.ref, 'refs/tags/') }}) && echo "HEXRD_PACKAGE_CHANNEL=HEXRD" >> $GITHUB_ENV || echo "HEXRD_PACKAGE_CHANNEL=HEXRD/label/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 | |
# Use libmamba as the solver for all future conda commands | |
export CONDA_SOLVER=libmamba | |
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@v3 | |
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@v3 | |
with: | |
name: wix.log | |
path: ${{ github.workspace }}/hexrdgui/packaging/_CPack_Packages/WIX/wix.log | |
- name: Upload installer package | |
uses: actions/upload-artifact@v3 | |
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@v3 | |
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@v3 | |
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 prerelease ) | |
run: | | |
[[ ${{ github.event_name }} = 'push' && ${{ github.ref }} = 'refs/heads/master' ]] && echo "HEXRDGUI_PACKAGE_LABEL=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 | |
conda install --override-channels -c conda-forge anaconda-client | |
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} |