-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (110 loc) · 3.24 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
# This file is part of cjdk.
# Copyright 2022 Board of Regents of the University of Wisconsin System
# SPDX-License-Identifier: MIT
name: CI
on:
pull_request:
push:
branches:
- main
tags:
- v*
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
test:
strategy:
matrix:
runner: [ubuntu-latest, macos-latest, windows-latest]
name: test-${{ matrix.runner }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for setuptools_scm
- uses: excitedleigh/[email protected]
- run: nox
docs:
needs:
- lint
- test
concurrency:
group: publish-gh-pages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for setuptools_scm
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install tools
run: |
python -m pip install --user --upgrade pip setuptools nox
- name: Build docs
run: |
python -m nox -s docs
- name: Publish to gh-pages (latest)
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
destination_dir: latest
commit_message: Deploy latest
- name: Get version from tag
id: get_version
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION="${GITHUB_REF##refs/tags/v}"
echo "::set-output name=version::${VERSION}"
- name: Publish to gh-pages (tag)
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
destination_dir: ${{ steps.get_version.outputs.version }}
commit_message: Deploy ${{ steps.get_version.outputs.version }}
publish:
needs:
- lint
- test
- docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for setuptools_scm
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install tools
run: |
python -m pip install --user --upgrade pip setuptools build
- name: Build sdist and wheel
run: |
python -m build --sdist --wheel --outdir dist .
- name: Publish on PyPI
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}