-
Notifications
You must be signed in to change notification settings - Fork 43
185 lines (168 loc) · 7.73 KB
/
tests.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: 'Tests'
on:
push:
pull_request:
types: [opened, synchronize] #labeled, assigned]
jobs:
build-and-test:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8, 3.9, 3.11]
steps:
# --- Install steps
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
# --- Versioning
- name: Versioning
id: versioning
run: |
git fetch --unshallow > /dev/null
git fetch --tags --force > /dev/null
export CURRENT_TAG="v0.4"
export CURRENT_DEV_TAG="$CURRENT_TAG-dev"
# BRANCH FAILS
export BRANCH1=`git rev-parse --abbrev-ref HEAD`
export BRANCH="${GITHUB_REF#refs/heads/}"
echo "GIT DESCRIBE: `git describe`"
echo "GITHUB_REF: $GITHUB_REF"
echo "GIT BRANCH1: $BRANCH1"
echo "GIT BRANCH: $BRANCH"
echo "Commits: `git rev-list $CURRENT_TAG.. --count`"
echo "Commits-dev: `git rev-list $CURRENT_DEV_TAG.. --count`"
# Check if current version corresponds to a tagged commit
if [[ $GITHUB_REF == *"tags"* ]]; then
echo ">>> This is a tagged version"
export VERSION_TAG=${GITHUB_REF/refs\/tags\//}
export VERSION_NAME=$VERSION_TAG
export FULL_VERSION_NAME="version $VERSION_NAME"
elif [[ $GITHUB_REF == *"main"* ]]; then
echo ">>> This is not a tagged version, but on the main branch"
export VERSION_TAG=$CURRENT_TAG
export VERSION_NAME="$CURRENT_TAG-`git rev-list $CURRENT_TAG.. --count`"
export FULL_VERSION_NAME="version $VERSION_NAME"
#elif [[ $BRANCH == "dev" ]]; then
# echo ">>> This is not a tagged version, but on the dev branch"
# export VERSION_TAG=$CURRENT_DEV_TAG ;
# export VERSION_NAME=`git describe | sed 's/\(.*\)-.*/\1/'`
# export FULL_VERSION_NAME="latest dev. version $VERSION_NAME"
else
echo ">>> This is not a tagged version, but on a special branch"
export VERSION_TAG=$CURRENT_DEV_TAG ;
export VERSION_NAME=`git describe | sed 's/\(.*\)-.*/\1/'`
export FULL_VERSION_NAME="latest dev. version $VERSION_NAME"
fi
echo "VERSION_TAG $VERSION_TAG"
echo "VERSION_NAME: $VERSION_NAME"
echo "FULL_VERSION_NAME: $FULL_VERSION_NAME"
# Save variables as github outputs
echo "BRANCH=$BRANCH" >> $GITHUB_OUTPUT
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_OUTPUT
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT
echo "FULL_VERSION_NAME=$FULL_VERSION_NAME" >> $GITHUB_OUTPUT
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
#python -m pip install --upgrade pip
# --- Attempt for wxpython, but we don't have access to X display
#sudo apt-get install libgtk-3-dev
#sudo apt-get install git curl libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0 || true
#sudo apt-get install libnotify-dev || true
#sudo apt-get install libnotify4 || true
#pip install -U wxpython || true
#pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython || true
pip install -r _tools/travis_requirements.txt
pip install -e .
- name: System info
run: |
echo "Actor : $GITHUB_ACTOR"
echo "Branch: $GITHUB_REF"
pip list
ls
# --- Run Tests
- name: Tests
run: |
make test
# --- Check if Deployment if needed
- name: Check if deployment is needed
id: check_deploy
env:
PY_VERSION: ${{matrix.python-version}}
GH_EVENT : ${{github.event_name}}
BRANCH : ${{steps.versioning.outputs.BRANCH}}
run: |
echo "GH_EVENT : $GH_EVENT"
echo "PY_VERSION : $PY_VERSION"
echo "GIT BRANCH : $BRANCH"
export OK=0
# Only deploy for push events
if [[ $PY_VERSION == "3.9" ]]; then
if [[ $GH_EVENT == "push" ]]; then
# BRANCH FAILS
if [[ $BRANCH == "main" ]] || [[ $BRANCH == "dev" ]] || [[ $BRANCH == "HEAD" ]] ; then
export OK=1 ;
fi
fi
fi
echo "DEPLOY : $OK"
if [[ $OK == "1" ]]; then
echo ">>> Deployment WILL take place"
else
echo ">>> Deployment WILL NOT take place"
fi
# Save variables as github outputs
echo "GO=$OK" >> $GITHUB_OUTPUT
# --- Run Deployments
- name: Install system dependencies
if: ${{ steps.check_deploy.outputs.GO == '1'}}
run: sudo apt-get install nsis
- name: Before deploy
if: ${{ steps.check_deploy.outputs.GO == '1'}}
id: before_deploy
env:
FULL_VERSION_NAME: ${{steps.versioning.outputs.FULL_VERSION_NAME}}
VERSION_NAME: ${{steps.versioning.outputs.VERSION_NAME}}
VERSION_TAG: ${{steps.versioning.outputs.VERSION_TAG}}
run: |
echo "FULL_VERSION_NAME: $FULL_VERSION_NAME"
echo "VERSION_NAME : $VERSION_NAME"
echo "VERSION_TAG : $VERSION_TAG"
pip install pynsist
pip install distlib
git clone https://github.com/takluyver/pynsist
mv pynsist/nsist nsist
sh _tools/setVersion.sh $VERSION_NAME
make installer
mv build/nsis/pyDatView_setup.exe "pyDatView_"$VERSION_NAME"_setup.exe"
mv _tools/pyDatView.cmd build/nsis/
mv _tools/pyDatView_Test.bat build/nsis/
mv _tools/pyDatView.exe build/nsis/
mv build/nsis build/pyDatView_$VERSION_NAME
cd build && zip -r "../pyDatView_"$VERSION_NAME"_portable.zip" pyDatView_$VERSION_NAME
cd ..
if [[ "$VERSION_TAG" == *"-dev"* ]]; then cp "pyDatView_"$VERSION_NAME"_setup.exe" "pyDatView_LatestVersion_setup.exe" ;fi
if [[ "$VERSION_TAG" == *"-dev"* ]]; then cp "pyDatView_"$VERSION_NAME"_portable.zip" "pyDatView_LatestVersion_portable.zip" ;fi
ls
- name: Deploy
if: ${{ steps.check_deploy.outputs.GO == '1'}}
env:
FULL_VERSION_NAME: ${{steps.versioning.outputs.FULL_VERSION_NAME}}
VERSION_NAME: ${{steps.versioning.outputs.VERSION_NAME}}
VERSION_TAG: ${{steps.versioning.outputs.VERSION_TAG}}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pyDatView_*.*
release_name: ${{steps.versioning.outputs.FULL_VERSION_NAME}}
tag: ${{steps.versioning.outputs.VERSION_TAG}}
overwrite: true
file_glob: true
body: |
Different development versions are found in the "Assets" below.
Select the one with the highest number to get the latest development version.
Use a file labelled "setup" for a windows installer. No admin right is required for this installation, but the application is not signed. You may use a file labelled "portable" for a self contained zip files.