-
Notifications
You must be signed in to change notification settings - Fork 14
139 lines (122 loc) · 5.13 KB
/
package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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: 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 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}