-
Notifications
You must be signed in to change notification settings - Fork 1.6k
98 lines (92 loc) · 3.18 KB
/
Copy pathweekly-preview.yml
File metadata and controls
98 lines (92 loc) · 3.18 KB
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
name: weekly-preview
permissions:
contents: read
on:
schedule:
- cron: "0 2 * * 0" # 02:00 of every Sunday
pull_request:
branches:
- dev
env:
PYTHON_VER: '3.10'
PYTORCH_VER: '2.8.0'
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster
jobs:
static-checks:
if: github.event_name == 'schedule' # only check on cron run, these checks are redundant in a PR
runs-on: ubuntu-latest
strategy:
matrix:
opt: ["codeformat", "pyrefly"]
steps:
- name: Clean unused tools
run: |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc /usr/local/.ghcup
sudo docker system prune -f
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up Python ${{ env.PYTHON_VER }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VER }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install -U pip wheel
python -m pip install .[all,testing]
- name: Lint and type check
run: |
# clean up temporary files
$(pwd)/runtests.sh --build --clean
$(pwd)/runtests.sh --build --${{ matrix.opt }}
publish:
if: github.repository == 'Project-MONAI/MONAI'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# get the ref for the PR branch or dev if this is a cron job
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'dev' }}
fetch-depth: 0
persist-credentials: false
- name: Set up Python ${{ env.PYTHON_VER }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VER }}
cache: 'pip'
- name: Install tools
run: |
python -m pip install -U pip build
- name: Build distribution
run: |
export HEAD_COMMIT_ID=$(git rev-parse HEAD)
sed -i 's/name\ =\ "monai"$/name\ =\ "monai-weekly"/g' pyproject.toml
echo "__commit_id__ = \"$HEAD_COMMIT_ID\"" >> monai/__init__.py
git diff pyproject.toml monai/__init__.py
git config user.name "CI Builder"
git config user.email "monai.contact@gmail.com"
git add pyproject.toml 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.7.dev${YEAR_WEEK}"
git log -1
git tag --list
python -m build
ls -lh dist
- name: Test Installation
run: |
pip install dist/*.whl
pip list
(cd "$(mktemp -d)" && python -c 'import monai; print(monai.__version__)')
- name: Publish to PyPI
if: github.event_name == 'schedule' # only publish on cron run
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}