Skip to content

Commit 88dae37

Browse files
committed
fix Updating GH workflows and setting ruff config
Signed-off-by: S3B4SZ17 <[email protected]>
1 parent de94a65 commit 88dae37

25 files changed

+585
-568
lines changed

.github/workflows/ci-master-scheduled.yml renamed to .github/workflows/ci-master-scheduled.yaml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
scheduled-test:
1010
strategy:
11-
max-parallel: 1
11+
max-parallel: 3
1212
fail-fast: false
1313
matrix:
1414
python_version:
@@ -22,21 +22,23 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424

25-
- name: Install uv
26-
uses: astral-sh/setup-uv@v5
25+
- name: Setup python
26+
uses: actions/setup-python@v5
2727
with:
28-
enable-cache: true
29-
cache-dependency-glob: "uv.lock"
28+
python-version: "${{ matrix.python_version }}"
3029

31-
- uses: actions/setup-python@v5
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v6
3232
with:
33-
python-version: ${{ matrix.python_version }}
33+
python-version: "${{ matrix.python_version }}"
34+
enable-cache: true
35+
version: "0.8.7"
3436

3537
- name: Lint
36-
uses: astral-sh/ruff-action@v3
37-
38-
- name: Check format
39-
run: ruff format --check
38+
continue-on-error: true
39+
run: |
40+
# stop the build if there are Python syntax errors or undefined names
41+
uvx ruff check . --fix --statistics --config ruff.toml --exclude specs
4042
4143
- name: Travis Test - Start agent
4244
id: start_agent
@@ -47,11 +49,6 @@ jobs:
4749
sudo apt-get install linux-headers-$(uname -r) dkms gcc-multilib g++-multilib
4850
./test/start_agent.sh
4951
50-
- name: Travis Test - Install dependencies
51-
run: |
52-
uv build
53-
python -m pip install $(find dist -iname "*.whl" | head -1)
54-
5552
- name: Travis Test - Secure APIs
5653
env:
5754
PYTHON_SDC_TEST_API_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
@@ -63,7 +60,7 @@ jobs:
6360
SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
6461
SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com"
6562
SDC_SECURE_URL: "https://secure-staging.sysdig.com"
66-
run: uv run mamba -f documentation
63+
run: uv run -- mamba -f documentation
6764

6865
- name: Travis Test - Stop agent
6966
run: ./test/stop_agent.sh
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: CI - Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
needs:
11+
- test-release
12+
strategy:
13+
max-parallel: 3
14+
fail-fast: true
15+
matrix:
16+
python_version:
17+
# https://python-release-cycle.glitch.me/
18+
- "3.9"
19+
- "3.10"
20+
- "3.11"
21+
- "3.12"
22+
- "3.13"
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "${{ matrix.python_version }}"
31+
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v6
34+
with:
35+
python-version: "${{ matrix.python_version }}"
36+
enable-cache: true
37+
cache-dependency-glob: "uv.lock"
38+
version: "0.8.7"
39+
40+
- name: Lint
41+
run: |
42+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
43+
uvx ruff check . --fix --statistics --config ruff.toml --exclude specs
44+
45+
- name: Test in staging
46+
env:
47+
SDC_MONITOR_TOKEN: ${{ secrets.STAGING_MONITOR_API_TOKEN }}
48+
SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
49+
SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com"
50+
SDC_SECURE_URL: "https://secure-staging.sysdig.com"
51+
run: uv run mamba -f documentation -t integration
52+
53+
test-release:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
60+
- name: Setup go-chglog
61+
working-directory: /tmp
62+
env:
63+
VERSION: "0.10.0"
64+
run: |
65+
wget https://github.com/git-chglog/git-chglog/releases/download/v${VERSION}/git-chglog_${VERSION}_linux_amd64.tar.gz
66+
gunzip git-chglog_${VERSION}_linux_amd64.tar.gz
67+
tar -xvf git-chglog_${VERSION}_linux_amd64.tar
68+
sudo mv git-chglog /usr/local/bin/
69+
70+
- name: Generate changelog
71+
run: git-chglog -c .github/git-chglog/config.yml -o RELEASE_CHANGELOG.md $(git describe --tags $(git rev-list --tags --max-count=1))
72+
73+
- name: Set up Python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: "3.10"
77+
78+
- name: Install uv
79+
uses: astral-sh/setup-uv@v6
80+
with:
81+
python-version: "3.10"
82+
enable-cache: true
83+
version: "0.8.7"
84+
85+
- name: Build
86+
run: uv build
87+
check_version:
88+
name: Check Version
89+
runs-on: ubuntu-latest
90+
needs: test
91+
permissions:
92+
contents: write # required for creating a tag
93+
steps:
94+
- name: Check out repository
95+
uses: actions/checkout@v4
96+
with:
97+
ref: ${{ github.sha }} # required for better experience using pre-releases
98+
fetch-depth: '0' # Required due to the way Git works, without it this action won't be able to find any or the correct tags
99+
100+
- name: Extract current version
101+
id: pyproject_version
102+
run: |
103+
TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')
104+
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
105+
106+
- name: Get branch ref name
107+
id: branch_ref
108+
run: |
109+
BRANCH_NAME=${{ github.base_ref || github.ref_name }}
110+
echo "$BRANCH_NAME"
111+
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
112+
113+
- name: Get tag version
114+
id: semantic_release
115+
uses: anothrNick/[email protected]
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
DEFAULT_BUMP: "patch"
119+
TAG_CONTEXT: 'repo'
120+
WITH_V: true
121+
DRY_RUN: true
122+
123+
- name: Compare versions
124+
run: |
125+
echo "Current version: ${{ steps.pyproject_version.outputs.TAG }}"
126+
echo "New version: ${{ steps.semantic_release.outputs.tag }}"
127+
if [ "${{ steps.pyproject_version.outputs.TAG }}" != "${{ steps.semantic_release.outputs.tag }}" ]; then
128+
echo "### Version mismatch detected! :warning:
129+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
130+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
131+
Current Tag: ${{ steps.semantic_release.outputs.old_tag }}
132+
Please update the version in pyproject.toml." >> $GITHUB_STEP_SUMMARY
133+
exit 1
134+
else
135+
echo "### Version match confirmed! :rocket:
136+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
137+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
138+
The version is up-to-date." >> $GITHUB_STEP_SUMMARY
139+
fi

.github/workflows/ci-pull-request.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml renamed to .github/workflows/codeql-analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
with:
4848
languages: ${{ matrix.language }}
4949
# If you wish to specify custom queries, you can do so here or in a config file.
50-
# By default, queries listed here will override any specified in a config file.
50+
# By default, queries listed here will override any specified in a config file.
5151
# Prefix the list here with "+" to use these queries and those in the config file.
5252
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5353

.github/workflows/python.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator.
2+
# URL: https://openapi-generator.tech
3+
#
4+
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
5+
6+
name: sysdig_client Python package
7+
8+
on:
9+
push:
10+
pull_request:
11+
workflow_call:
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
21+
max-parallel: 5
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v6
33+
with:
34+
python-version: "${{ matrix.python-version }}"
35+
enable-cache: true
36+
version: "0.8.7"
37+
38+
- name: Download dependencies
39+
run: make init
40+
41+
- name: Run ruff check
42+
run: uvx ruff check . --fix --statistics --config ruff.toml --exclude specs
43+
44+
- name: Run Tests
45+
run: make test-all

.github/workflows/release.yml renamed to .github/workflows/release.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
tags:
66
- v*
7-
7+
workflow_dispatch:
88
jobs:
99
release:
1010
runs-on: ubuntu-latest
@@ -47,19 +47,20 @@ jobs:
4747
steps:
4848
- uses: actions/checkout@v4
4949

50-
- name: Install uv
51-
uses: astral-sh/setup-uv@v5
52-
with:
53-
enable-cache: true
54-
cache-dependency-glob: "uv.lock"
55-
5650
- name: Set up Python
5751
uses: actions/setup-python@v5
5852
with:
5953
python-version: "3.10"
6054

61-
- name: Build
62-
run: uv build
63-
64-
- name: Publish
65-
run: uv publish -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }}
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v6
57+
with:
58+
python-version: "3.10"
59+
enable-cache: true
60+
cache-dependency-glob: "uv.lock"
61+
version: "0.8.7"
62+
63+
- name: Build and publish
64+
run: |
65+
uv build
66+
uv publish -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }}

0 commit comments

Comments
 (0)