-
Notifications
You must be signed in to change notification settings - Fork 4
148 lines (131 loc) · 5.35 KB
/
ci.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
name: GitHub CI
on:
pull_request:
push:
tags:
- "*"
branches:
- main
jobs:
style:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Test with tox
run: tox -e style
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Build documentation
run: tox -e doc
- name: Upload Documentation
uses: actions/upload-artifact@v2.2.1
with:
name: Documentation
path: .tox/doc_out/
retention-days: 7
- name: Deploy to gh-pages
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: .tox/doc_out/
CLEAN: true
SINGLE_COMMIT: true
tests:
name: Test baked project
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
build-system: ["flit", "setuptools"]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade pip ${{ matrix.build-system }} tox tox-gh-actions
# Runs only the tox environment specified in tox.ini [gh-actions]
- name: Test with tox-gh-actions
run: tox
# Baked project actions are tested only for Linux-base OS
- name: Install and configure act for Linux-based OS
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install build-essential gcc
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
brew install act
echo "-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest" >> ~/.actrc
- name: Test flit baked project
if: matrix.os == 'ubuntu-latest' && matrix.build-system == 'flit'
run: |
# Change to baked project directory
cd output/test_bake_project_with_build_s0/pyproduct-library
# Initialize it as git repository (pre-commit needs it)
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git init && git add . && git commit -m "Init Python package"
# TODO: Only filter out errors from tox command
# act -j tests docs > act_output.log || true > act_output.log; grep -c ERROR act_output.log && cat act_output.log
tox
# Check package builds properly
python -m pip install -r requirements/requirements_build.txt
flit build
python -m twine check dist/*
- name: Test poetry baked project
if: matrix.os == 'ubuntu-latest' && matrix.build-system == 'poetry'
run: |
# Change to baked project directory
cd output/test_bake_project_with_build_s1/pyproduct-library
# Initialize it as git repository (pre-commit needs it)
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git init && git add . && git commit -m "Init Python package"
# TODO: Only filter out errors from tox command
# act -j tests docs > act_output.log || true > act_output.log; grep -c ERROR act_output.log && cat act_output.log
tox
# Check package builds properly
poetry run python -m pip install -r requirements/requirements_build.txt
poetry build
poetry run python -m twine check dist/*
- name: Test setuptools baked project
if: matrix.os == 'ubuntu-latest' && matrix.build-system == 'setuptools'
run: |
# Change to baked project directory
cd output/test_bake_project_with_build_s2/pyproduct-library
# Initialize it as git repository (pre-commit needs it)
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git init && git add . && git commit -m "Init Python package"
# TODO: Only filter out errors from tox command
# act -j tests docs > act_output.log || true > act_output.log; grep -c ERROR act_output.log && cat act_output.log
tox
# Check package builds properly
python -m pip install -r requirements/requirements_build.txt
python -m build
python -m twine check dist/*