-
Notifications
You must be signed in to change notification settings - Fork 2
139 lines (139 loc) · 4.24 KB
/
push.yaml
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
name: push
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: "pip"
- uses: pre-commit/[email protected]
test:
runs-on: ubuntu-latest
environment: test
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies for testing
run: pip install pytest pytest-cov
- name: Install module
run: pip install -r requirements.txt && pip install -e .
- name: pytest
run: pytest --cov=materialx --cov-report=xml --cov-report=html .
- name: Upload coverage report for documentation
uses: actions/upload-artifact@v3
with:
name: coverage
path: htmlcov
retention-days: 5
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage reports to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
pages:
if: startsWith(github.event.ref, 'refs/tags/v') || contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref)
needs: [test]
environment: github-pages
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- uses: actions/cache@v3
with:
key: ${{ github.ref }}
path: .cache
- run: pip install -r docs/requirements.txt
- run: pip install -e .
- name: Download coverage report
uses: actions/download-artifact@v3
with:
name: coverage
path: htmlcov
- run: mkdocs build -v -f docs/mkdocs.yml
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/site
release:
if: startsWith(github.event.ref, 'refs/tags/v')
needs: [lint, test]
environment: pypi
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: "pip"
- name: Install dependencies for building
run: pip install wheel setuptools_scm
- name: build package
run: python setup.py sdist bdist_wheel
- name: create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
dist/*
- name: publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
develop:
if: contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref)
needs: [lint, test]
environment: pypi
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: "pip"
- name: Install dependencies for building
run: pip install wheel setuptools_scm
- name: build package
run: python setup.py sdist bdist_wheel
- name: create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
dist/*