-
Notifications
You must be signed in to change notification settings - Fork 22
175 lines (165 loc) · 5.42 KB
/
release.yml
File metadata and controls
175 lines (165 loc) · 5.42 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
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
166
167
168
169
170
171
172
173
174
175
#
# Release workflow - triggered on version tag push (e.g., v0.2.0) or manually
#
# This workflow:
# 1. Runs all CI checks (lint, type-check, tests)
# 2. Builds the package (sdist + wheel)
# 3. Publishes to PyPI using Trusted Publishing (OIDC)
# 4. Creates a GitHub Release with auto-generated notes
#
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*' # Allow pre-release tags like v0.2.0-beta1
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v0.2.0)'
required: true
type: string
env:
# Use input tag for workflow_dispatch, or ref_name for tag push
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
# Required for PyPI Trusted Publishing (OIDC)
permissions:
contents: write # For creating GitHub releases
id-token: write # For PyPI OIDC authentication
jobs:
#
# Run all CI checks before releasing
#
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref_name }}
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: ./.github/scripts/install-drgn.sh
- run: python3 -m pip install pylint pytest ruff yapf
- run: python3 -m pip install .
- run: pylint -d duplicate-code -d invalid-name -d missing-docstring -d import-outside-toplevel -d too-many-branches -d missing-module-docstring -d missing-function-docstring sdb
- run: pylint -d duplicate-code -d invalid-name -d missing-docstring -d import-outside-toplevel -d too-many-branches -d missing-module-docstring -d missing-function-docstring tests
- run: ruff check sdb tests
- run: yapf --diff --style google --recursive sdb
- run: yapf --diff --style google --recursive tests
type-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref_name }}
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: ./.github/scripts/install-drgn.sh
- run: python3 -m pip install mypy pytest
- run: python3 -m pip install .
- run: python3 -m mypy --strict --show-error-codes -p sdb
- run: python3 -m mypy --strict --ignore-missing-imports --show-error-codes -p tests
test-unit:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ['3.10', '3.12']
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref_name }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python3 -m pip install pytest pytest-cov
- run: ./.github/scripts/install-drgn.sh
- run: python3 -m pip install .
- run: pytest -v --cov sdb --cov-report xml tests/unit
test-integration:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ['3.10', '3.12']
env:
AWS_DEFAULT_REGION: 'us-west-2'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref_name }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python3 -m pip install pytest pytest-cov
- run: ./.github/scripts/install-libkdumpfile.sh
- run: ./.github/scripts/install-drgn.sh
- run: python3 -m pip install .
- run: ./.github/scripts/download-dumps-from-gdrive.sh
- run: ./.github/scripts/extract-dump.sh dump.201912060006.tar.lzma
- run: ./.github/scripts/extract-dump.sh dump.202303131823.tar.gz
- run: pytest -v --cov sdb --cov-report xml tests/integration
#
# Build the package
#
build:
needs: [lint, type-check, test-unit, test-integration]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref_name }}
fetch-depth: 0 # Required for setuptools_scm to get version from tags
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install build dependencies
run: python3 -m pip install build
- name: Build package
run: python3 -m build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
#
# Publish to PyPI using Trusted Publishing (OIDC)
#
publish-pypi:
needs: build
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/project/sdb-debugger/
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
#
# Create GitHub Release with auto-generated notes
#
github-release:
needs: publish-pypi
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref_name }}
fetch-depth: 0 # Required for generating release notes
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create '${{ env.RELEASE_TAG }}' \
--title 'sdb ${{ env.RELEASE_TAG }}' \
--generate-notes \
dist/*