-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (139 loc) · 4.31 KB
/
CICD.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: CI Testing
on:
push:
branches: [main, devel, release]
pull_request:
branches: [main, devel, release]
jobs:
cheap_checks:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
# Python setup
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Debug Info
run: echo ${{ github.ref }} ${{ github.event_name }} ${{ endsWith(github.ref, 'heads/release') && (github.event_name == 'push') }}
# refs/heads/main push false is the output of the main branch when tagged with a release ...
- name: View Python --version
run: python --version
# Poetry Setup
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: "1.2.2"
- name: View poetry --version
run: poetry --version
- name: Install Stuff
run: poetry install --no-root --only checks
- name: Black
run: poetry run black . --check --diff
- name: ruff
run: poetry run ruff .
- name: isort
run: poetry run isort . --check
ci:
needs: cheap_checks
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.9"]
poetry-version: ["1.2.2"]
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
# Initial Setup
- uses: actions/checkout@v3
# Documentation setup
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: View Quarto version
run: quarto --version
# Python setup
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: View Python --version
run: python --version
# Poetry Setup
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: View poetry --version
run: poetry --version
# Package Setup
- name: Install deps
run: poetry install -n -v --with=plotting,dev,docs
# CI checks
- name: Pytest
run: poetry run python -m pytest
- name: mkdocs
run: poetry run python -m mkdocs build --strict
release:
# Run when there is a new push on the release branch
runs-on: "ubuntu-latest"
needs: ci
if: endsWith(github.ref, 'heads/release') && (github.event_name == 'push')
steps:
- uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
# Documentation setup
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: View Quarto version
run: quarto --version
# Python setup
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: View Python --version
run: python --version
# Poetry Setup
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: "1.2.2"
- name: View poetry --version
run: poetry --version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Package Setup
- name: Install deps
run: poetry install -n -v --all-extras
# Build
- name: Build package
run: |
poetry build
# Docker Setup
- name: Build Docker image
id: dockerbuild
run: |
docker build -t ghcr.io/jspaezp/elfragmentador:v$(poetry version -s) .
# Publish Docker
- name: Push the Docker image to the GHCR
id: ghcr_push
run: |
docker push ghcr.io/jspaezp/elfragmentador:v$(poetry version -s)
# Publishing Docs
- name: Deploy Docs
run: |
poetry run python -m mkdocs gh-deploy --strict --force
# Publish Package
- name: Publish Setup
env:
PYPITOKEN: ${{ secrets.PYPITOKEN }}
run: |
poetry config pypi-token.pypi ${PYPITOKEN}
- name: Publish
run: |
poetry publish --no-interaction