Skip to content

Commit ae52b52

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

24 files changed

+541
-571
lines changed

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

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,36 @@ 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:
1515
# https://python-release-cycle.glitch.me/
16-
- "3.7"
17-
- "3.8"
18-
- "3.9"
1916
- "3.10"
2017
- "3.11"
18+
- "3.12"
19+
- "3.13"
2120
runs-on: ubuntu-latest
2221
steps:
2322
- uses: actions/checkout@v4
2423

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

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

3536
- name: Lint
36-
uses: astral-sh/ruff-action@v3
37-
38-
- name: Check format
39-
run: ruff format --check
37+
continue-on-error: true
38+
run: |
39+
# stop the build if there are Python syntax errors or undefined names
40+
uvx ruff check . --fix --statistics --config ruff.toml --exclude specs
4041
4142
- name: Travis Test - Start agent
4243
id: start_agent
@@ -47,11 +48,6 @@ jobs:
4748
sudo apt-get install linux-headers-$(uname -r) dkms gcc-multilib g++-multilib
4849
./test/start_agent.sh
4950
50-
- name: Travis Test - Install dependencies
51-
run: |
52-
uv build
53-
python -m pip install $(find dist -iname "*.whl" | head -1)
54-
5551
- name: Travis Test - Secure APIs
5652
env:
5753
PYTHON_SDC_TEST_API_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
@@ -63,7 +59,7 @@ jobs:
6359
SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
6460
SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com"
6561
SDC_SECURE_URL: "https://secure-staging.sysdig.com"
66-
run: uv run mamba -f documentation
62+
run: uv run -- mamba -f documentation
6763

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

.gitignore

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
33
*.py[cod]
4+
*$py.class
45

56
# C extensions
67
*.so
@@ -42,6 +43,12 @@ htmlcov/
4243
nosetests.xml
4344
coverage.xml
4445
*,cover
46+
.hypothesis/
47+
venv/
48+
.venv/
49+
.python-version
50+
.pytest_cache
51+
pytest.xml
4552

4653
# Translations
4754
*.mo
@@ -56,15 +63,5 @@ docs/_build/
5663
# PyBuilder
5764
target/
5865

59-
# virtualenv
60-
venv/
61-
62-
# Direnv
63-
.envrc
64-
.direnv/
65-
.secrets
66-
67-
# IntelliJ projects
68-
.idea/
69-
70-
coverage/
66+
#Ipython Notebook
67+
.ipynb_checkpoints

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repos:
44
hooks:
55
# Run the linter.
66
- id: ruff
7-
args: [ --fix ]
7+
args: [ --fix, --config, ruff.toml ]
88
# Run the formatter.
99
- id: ruff-format
1010

0 commit comments

Comments
 (0)