Repository navigation
80 lines (78 loc) · 2.49 KB
/
Copy pathtest-and-release.yml
File metadata and controls
80 lines (78 loc) · 2.49 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
name: Tests 🧪
on: push
jobs:
test:
name: Test 🔧
runs-on: ubuntu-20.04
steps:
- name: Checkout code 🛎️
uses: actions/checkout@v2.3.1
with:
persist-credentials: false
- name: Cache models and data
uses: actions/cache@v3
with:
path: |
/home/runner/.cache/torch
key: ${{ runner.os }}-data_models
- name: Set up Python 3.7 🐍
uses: actions/setup-python@v3
with:
python-version: 3.7
cache: 'pip'
- name: Install dependencies 💾
run: |
pip install -r requirements-dev.txt
pip install torch==1.8.0 torchvision==0.9.0
- name: Get PyTorch model
run: |
python -c 'import torchvision.models as models; models.inception_v3(pretrained=True);'
python -c 'import torchvision.models as models; models.alexnet(pretrained=True);'
- name: Execute tests
env:
PYTHONPATH: '.'
PYTHON_VERSION: '3.7'
run: >
pytest
--junit-xml=_pytest_junit_$(PYTHON_VERSION).xml
--cov-report=term-missing
--cov-report=xml:_pytest_coverage_$(PYTHON_VERSION).xml
--cov=xml_book
xml_book/
github-release:
name: Release to GitHub
needs: test
if: >
github.event_name == 'push'
&& github.repository == 'xmlx-dev/xml-book-code'
&& startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-20.04
steps:
- name: Checkout code 🛎️
uses: actions/checkout@v2.3.1
with:
fetch-depth: 5
submodules: false
persist-credentials: false
- name: Set up Python 3.7 🐍
uses: actions/setup-python@v3
with:
python-version: 3.7
cache: 'pip'
- name: Install the package 💾
run: |
pip install .
- name: Set env
run: echo "GITHUB_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Validate package version
run: ./build_tools/check_version.sh
- name: Build a binary wheel and a source tarball distributions 📦
run: python setup.py sdist bdist_wheel
- name: 📦 Create GitHub Release 🚀
if: startsWith(github.ref, 'refs/tags')
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
title: "XML Book Python package ${GITHUB_TAG}"
files: dist/*