forked from Project-MONAI/MONAI
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (74 loc) · 2.47 KB
/
weekly-preview.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
name: weekly-preview
on:
schedule:
- cron: "0 2 * * 0" # 02:00 of every Sunday
jobs:
flake8-py3:
runs-on: ubuntu-latest
strategy:
matrix:
opt: ["codeformat", "pytype", "mypy"]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: cache weekly timestamp
id: pip-cache
run: |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
- name: cache for pip
uses: actions/cache@v4
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-dev.txt
- name: Lint and type check
run: |
# clean up temporary files
$(pwd)/runtests.sh --build --clean
# Github actions have 2 cores, so parallelize pytype
$(pwd)/runtests.sh --build --${{ matrix.opt }} -j 2
packaging:
if: github.repository == 'Project-MONAI/MONAI'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install setuptools
run: |
python -m pip install --user --upgrade setuptools wheel packaging
- name: Build distribution
run: |
export HEAD_COMMIT_ID=$(git rev-parse HEAD)
sed -i 's/name\ =\ monai$/name\ =\ monai-weekly/g' setup.cfg
echo "__commit_id__ = \"$HEAD_COMMIT_ID\"" >> monai/__init__.py
git diff setup.cfg monai/__init__.py
git config user.name "CI Builder"
git config user.email "[email protected]"
git add setup.cfg monai/__init__.py
git commit -m "Weekly build at $HEAD_COMMIT_ID"
export YEAR_WEEK=$(date +'%y%U')
echo "Year week for tag is ${YEAR_WEEK}"
if ! [[ $YEAR_WEEK =~ ^[0-9]{4}$ ]] ; then echo "Wrong 'year week' format. Should be 4 digits."; exit 1 ; fi
git tag "1.5.dev${YEAR_WEEK}"
git log -1
git tag --list
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}