Skip to content

Commit ec4c8a3

Browse files
committed
feat Updating the overall project CI/CD and openapi-generator dependencies
Signed-off-by: S3B4SZ17 <sebastian.zumbado@sysdig.com>
1 parent e9b0d33 commit ec4c8a3

File tree

1,862 files changed

+45136
-45945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,862 files changed

+45136
-45945
lines changed

.flake8

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

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

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,25 @@ jobs:
2020
- "3.11"
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424

25-
- uses: actions/setup-python@v4
25+
- name: Setup python
26+
uses: actions/setup-python@v5
2627
with:
27-
python-version: ${{ matrix.python_version }}
28+
python-version: "${{ matrix.python_version }}"
2829

29-
- name: Install Poetry
30-
run: python -m pip install poetry poetry-dynamic-versioning
31-
32-
- uses: actions/cache@v3
33-
name: Cache Poetry dependencies
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v6
3432
with:
35-
path: |
36-
~/.cache
37-
~/.local/share/virtualenvs/
38-
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
39-
restore-keys: |
40-
${{ runner.os }}-poetry-
41-
42-
- name: Get dependencies
43-
run: poetry install
33+
python-version: "${{ matrix.python_version }}"
34+
enable-cache: true
35+
version: "0.8.7"
4436

4537
- name: Lint
4638
continue-on-error: true
4739
run: |
4840
# stop the build if there are Python syntax errors or undefined names
49-
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
50-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
51-
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41+
uvx ruff check . --fix --select=E9,F63,F7,F82 --statistics --config ruff.toml --exclude specs
5242
5343
- name: Travis Test - Start agent
5444
id: start_agent
@@ -59,11 +49,6 @@ jobs:
5949
sudo apt-get install linux-headers-$(uname -r) dkms gcc-multilib g++-multilib
6050
./test/start_agent.sh
6151
62-
- name: Travis Test - Install dependencies
63-
run: |
64-
poetry build
65-
python -m pip install $(find dist -iname "*.whl" | head -1)
66-
6752
- name: Travis Test - Secure APIs
6853
env:
6954
PYTHON_SDC_TEST_API_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
@@ -75,7 +60,7 @@ jobs:
7560
SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
7661
SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com"
7762
SDC_SECURE_URL: "https://secure-staging.sysdig.com"
78-
run: poetry run mamba -f documentation
63+
run: uv run -- mamba -f documentation
7964

8065
- name: Travis Test - Stop agent
8166
run: ./test/stop_agent.sh

.github/workflows/ci-pull-request.yml renamed to .github/workflows/ci-pull-request.yaml

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,42 @@ jobs:
1515
matrix:
1616
python_version:
1717
# https://python-release-cycle.glitch.me/
18-
- "3.7"
19-
- "3.8"
2018
- "3.9"
2119
- "3.10"
2220
- "3.11"
2321
runs-on: ubuntu-latest
2422
steps:
25-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2624

27-
- uses: actions/setup-python@v4
25+
- name: Setup python
26+
uses: actions/setup-python@v5
2827
with:
29-
python-version: ${{ matrix.python_version }}
28+
python-version: "${{ matrix.python_version }}"
3029

31-
- name: Install Poetry
32-
run: python -m pip install poetry poetry-dynamic-versioning
33-
34-
- uses: actions/cache@v3
35-
name: Cache Poetry dependencies
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v6
3632
with:
37-
path: |
38-
~/.cache
39-
~/.local/share/virtualenvs/
40-
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
41-
restore-keys: |
42-
${{ runner.os }}-poetry-
43-
44-
- name: Get dependencies
45-
run: poetry install
33+
python-version: "${{ matrix.python_version }}"
34+
enable-cache: true
35+
version: "0.8.7"
4636

4737
- name: Lint
4838
run: |
49-
# stop the build if there are Python syntax errors or undefined names
50-
poetry run flake8
5139
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
52-
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
40+
uvx ruff check . --fix --select=E9,F63,F7,F82 --statistics --config ruff.toml --exclude specs
5341
5442
- name: Test in staging
5543
env:
5644
SDC_MONITOR_TOKEN: ${{ secrets.STAGING_MONITOR_API_TOKEN }}
5745
SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
5846
SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com"
5947
SDC_SECURE_URL: "https://secure-staging.sysdig.com"
60-
run: poetry run mamba -f documentation -t integration
48+
run: uv run -- mamba -f documentation -t integration
6149

6250
test-release:
6351
runs-on: ubuntu-latest
64-
steps:
65-
- uses: actions/checkout@v3
52+
steps:
53+
- uses: actions/checkout@v4
6654
with:
6755
fetch-depth: 0
6856

@@ -79,15 +67,17 @@ jobs:
7967
- name: Generate changelog
8068
run: git-chglog -c .github/git-chglog/config.yml -o RELEASE_CHANGELOG.md $(git describe --tags $(git rev-list --tags --max-count=1))
8169

82-
- name: Set up Python
83-
uses: actions/setup-python@v4
70+
- name: Setup python
71+
uses: actions/setup-python@v5
8472
with:
85-
python-version: 3.8
73+
python-version: "3.10"
8674

87-
- name: Install dependencies
88-
run: |
89-
python -m pip install --upgrade pip
90-
pip install poetry poetry-dynamic-versioning
75+
- name: Install uv
76+
uses: astral-sh/setup-uv@v6
77+
with:
78+
python-version: "3.10"
79+
enable-cache: true
80+
version: "0.8.7"
9181

9282
- name: Build
93-
run: poetry build
83+
run: uv build

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
3434
with:
3535
# We must fetch at least the immediate parents so that if this is
3636
# a pull request then we can checkout the head.
@@ -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

File renamed without changes.

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
upload_url: ${{ steps.create_release.outputs.upload_url }}
1313

1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
1818

@@ -52,10 +52,14 @@ jobs:
5252
with:
5353
python-version: 3.10
5454

55-
- name: Install dependencies
56-
run: |
57-
python -m pip install --upgrade pip
58-
pip install poetry poetry-dynamic-versioning
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v6
57+
with:
58+
python-version: 3.10
59+
enable-cache: true
60+
version: "0.8.7"
5961

6062
- name: Build and publish
61-
run: poetry publish --build -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }}
63+
run: |
64+
uv build
65+
uv publish -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }}

.github/workflows/test.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
name: Test
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- pyproject.toml
8+
- '*.py'
9+
workflow_call:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: 'tests-${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
14+
cancel-in-progress: true
15+
16+
jobs:
17+
test:
18+
name: Test
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read # required for actions/checkout
22+
steps:
23+
- name: Check out the repo
24+
uses: actions/checkout@v4
25+
26+
- name: Setup python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.10"
30+
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v5
33+
with:
34+
version: "0.7.17"
35+
36+
- name: Download dependencies
37+
run: make init
38+
39+
- name: Run ruff
40+
run: make lint
41+
42+
- name: Run Unit Tests
43+
run: make test
44+
45+
check_version:
46+
name: Check Version
47+
runs-on: ubuntu-latest
48+
needs: test
49+
permissions:
50+
contents: write # required for creating a tag
51+
steps:
52+
- name: Check out repository
53+
uses: actions/checkout@v4
54+
with:
55+
ref: ${{ github.sha }} # required for better experience using pre-releases
56+
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
57+
58+
- name: Extract current version
59+
id: pyproject_version
60+
run: |
61+
TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')
62+
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
63+
64+
- name: Get branch ref name
65+
id: branch_ref
66+
run: |
67+
BRANCH_NAME=${{ github.base_ref || github.ref_name }}
68+
echo "$BRANCH_NAME"
69+
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
70+
71+
- name: Get tag version
72+
id: semantic_release
73+
uses: anothrNick/github-tag-action@1.71.0
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
DEFAULT_BUMP: "patch"
77+
TAG_CONTEXT: 'repo'
78+
WITH_V: true
79+
DRY_RUN: true
80+
81+
- name: Compare versions
82+
run: |
83+
echo "Current version: ${{ steps.pyproject_version.outputs.TAG }}"
84+
echo "New version: ${{ steps.semantic_release.outputs.tag }}"
85+
if [ "${{ steps.pyproject_version.outputs.TAG }}" != "${{ steps.semantic_release.outputs.tag }}" ]; then
86+
echo "### Version mismatch detected! :warning:
87+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
88+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
89+
Current Tag: ${{ steps.semantic_release.outputs.old_tag }}
90+
Please update the version in pyproject.toml." >> $GITHUB_STEP_SUMMARY
91+
exit 1
92+
else
93+
echo "### Version match confirmed! :rocket:
94+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
95+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
96+
The version is up-to-date." >> $GITHUB_STEP_SUMMARY
97+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ venv/
4848
.venv/
4949
.python-version
5050
.pytest_cache
51+
pytest.xml
5152

5253
# Translations
5354
*.mo

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "api-spec"]
2+
path = api-spec
3+
url = git@github.com:draios/api-spec.git@0d4b5a9fb72b1bb2275878f0b46ec1cba3ee91a4

.openapi-generator-ignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
1616
#foo/**/qux
1717
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
.gitlab-ci.yml
19+
.travis.yml
20+
git_push.sh
21+
requirements.txt
22+
setup.cfg
23+
setup.py
24+
test-requirements.txt
25+
tox.ini
26+
pyproject.toml
1827

1928
# You can also negate patterns with an exclamation (!).
2029
# For example, you can ignore all files in a docs folder with the file extension .md:

0 commit comments

Comments
 (0)