-
Notifications
You must be signed in to change notification settings - Fork 24
133 lines (118 loc) · 4.06 KB
/
unstable.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
name: Build_Unstable
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ published ]
env:
branch_name: master
jobs:
test_and_build:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
#- { os: ubuntu-latest, py: 3.8, doc: 1 }
- { os: windows-latest, py: 3.9, exe: 1, whl: 1 }
#- { os: macos-latest, py: 3.8, whl: 1 }
# all using to stable abi
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.branch_name }}
- name: Set up Python ${{ matrix.config.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.py }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel setuptools
python -m pip install numpy scipy matplotlib periodictable scikit-learn pytest pytest-cov numba
pip install git+https://github.com/bumps/bumps.git
python setup.py build
mkdir unstable
- name: Run tests
run: |
pytest -v
python check_examples.py --chisq
env:
MPLBACKEND: agg
- name: Build binary wheel
run: |
python setup.py bdist_wheel
- name: Build source distribution
run: |
python setup.py sdist --formats=zip
mv dist\*.zip "unstable\Refl1D-$($env:branch_name)-source.zip"
ls
- name: Build installer
run: |
pwsh -command ".\$GITHUB_WORKSPACE\extra\build_win_installer_unstable.ps1"
mv dist\Refl1D*.zip "unstable\Refl1D-windows-exe-$($env:branch_name).zip"
# See the following for how to upload to a release
# https://eugene-babichenko.github.io/blog/2020/05/09/github-actions-cross-platform-auto-releases/
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
unstable/*
updateUnstable:
needs: test_and_build
runs-on: ubuntu-latest
steps:
- name: Retrieve all artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
- name: show files
run: |
ls * -l
- name: repack self-extracting
run: |
sudo apt-get install -y p7zip-full
mkdir self_extracting
curl -L https://www.7-zip.org/a/7z2106-x64.exe --output 7z.exe
7z e 7z.exe -aoa -oself_extracting 7z.sfx
unzip "Refl1D-windows-exe-$branch_name.zip" -d self_extracting
cd self_extracting && 7z a -mhe=on -mx=1 -sfx7z.sfx "../Refl1D-$branch_name-self-extracting.exe" Refl1D*/
- name: Update release assets and text
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs');
const { owner, repo } = context.repo;
let sid_release = await github.rest.repos.getReleaseByTag({
owner,
repo,
tag: "sid"
});
await github.rest.repos.updateRelease({
owner,
repo,
release_id: sid_release.data.id,
body: "A persistent prerelease where build artifacts for the current tip will be deposited\n\n## Last updated: " + (new Date()).toDateString()
});
// delete existing release assets (if needed) and upload new ones:
const to_update = ["Refl1D-windows-exe-${{ env.branch_name }}.zip", "Refl1D-${{ env.branch_name }}-source.zip", "Refl1D-${{ env.branch_name }}-self-extracting.exe"];
for (let fn of to_update) {
let asset_id = (sid_release.data.assets.find((a) => (a.name == fn)) ?? {}).id;
if (asset_id) {
await github.rest.repos.deleteReleaseAsset({
owner,
repo,
asset_id
});
}
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: sid_release.data.id,
name: fn,
data: await fs.readFileSync(fn)
});
}