Skip to content

Commit 2ecd049

Browse files
authored
Merge branch 'master' into cycode-fix-suggestion-manifest-dependency-update-509206c6-c3fc-44b2-8b41-51dd0a52637f
2 parents 5d3185c + 85b1fe7 commit 2ecd049

13 files changed

Lines changed: 775 additions & 92 deletions

.github/dependabot.yaml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
1+
# Dependabot configuration for automated dependency updates
2+
# See: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
53

64
version: 2
75
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
9-
directory: "/" # Location of package manifests
6+
- package-ecosystem: "pip"
7+
directory: "/"
108
schedule:
119
interval: "weekly"
10+
day: "monday"
11+
time: "09:00"
12+
timezone: "Asia/Jerusalem"
13+
groups:
14+
python-dependencies:
15+
patterns:
16+
- "*"
17+
commit-message:
18+
prefix: "deps"
19+
labels:
20+
- "dependencies"
21+
- "python"
22+
open-pull-requests-limit: 5
23+
1224
- package-ecosystem: "github-actions"
13-
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
1425
directory: "/"
1526
schedule:
16-
# Check for updates to GitHub Actions every weekday
1727
interval: "weekly"
28+
day: "monday"
29+
time: "09:00"
30+
timezone: "Asia/Jerusalem"
31+
groups:
32+
github-actions:
33+
patterns:
34+
- "*"
35+
commit-message:
36+
prefix: "ci"
37+
labels:
38+
- "dependencies"
39+
- "github-actions"
40+
open-pull-requests-limit: 5

.github/workflows/auto-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v6
1313
with:
1414
fetch-depth: 0
1515
- name: Set up Python
16-
uses: actions/setup-python@v5.1.1
16+
uses: actions/setup-python@v6
1717
with:
1818
python-version: '3.x'
1919
- name: Install dependencies
@@ -27,10 +27,10 @@ jobs:
2727
needs: ci-tests
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
3131
with:
3232
fetch-depth: 0
33-
- uses: actions/setup-python@v5.1.1
33+
- uses: actions/setup-python@v6
3434
with:
3535
python-version: '3.x'
3636
- name: Install dependencies

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
test:
11+
name: Test (Python ${{ matrix.python-version }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v6
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
cache: "pip"
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt
34+
pip install pytest pytest-cov future requests
35+
36+
- name: Install package in development mode
37+
run: pip install -e .
38+
39+
- name: Run unit tests with coverage
40+
run: |
41+
pytest --cov-report=term-missing --cov=logzio tests/ -v --ignore=tests/e2e/
42+
43+
- name: Upload coverage report
44+
if: matrix.python-version == '3.11'
45+
uses: actions/upload-artifact@v6
46+
with:
47+
name: coverage-report
48+
path: .coverage
49+
retention-days: 5
50+
51+
e2e-integration:
52+
name: E2E Integration Test
53+
runs-on: ubuntu-latest
54+
needs: [test]
55+
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v6
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Set up Python
63+
uses: actions/setup-python@v6
64+
with:
65+
python-version: "3.11"
66+
cache: "pip"
67+
68+
- name: Install dependencies
69+
run: |
70+
python -m pip install --upgrade pip
71+
pip install -r requirements.txt
72+
pip install pytest requests
73+
74+
- name: Install package in development mode
75+
run: pip install -e .
76+
77+
78+
- name: Generate unique ENV_ID
79+
id: env-id
80+
run: echo "value=e2e-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_OUTPUT
81+
82+
- name: Run E2E integration test
83+
env:
84+
LOGZIO_TOKEN: ${{ secrets.LOGZIO_TOKEN }}
85+
LOGZIO_API_KEY: ${{ secrets.LOGZIO_API_KEY }}
86+
ENV_ID: ${{ steps.env-id.outputs.value }}
87+
run: |
88+
pytest tests/e2e/test_logzio_e2e.py -v --tb=long
89+
90+
ci-success:
91+
name: CI Success
92+
runs-on: ubuntu-latest
93+
needs: [test, e2e-integration]
94+
if: always()
95+
steps:
96+
- name: Check all jobs passed
97+
run: |
98+
if [[ "${{ needs.test.result }}" != "success" ]]; then
99+
echo "Test job failed"
100+
exit 1
101+
fi
102+
if [[ "${{ needs.e2e-integration.result }}" != "success" ]]; then
103+
echo "E2E integration job failed"
104+
exit 1
105+
fi
106+
echo "All CI checks passed! ✅"
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: Dependency Auto-Merge
2+
3+
# This workflow runs AFTER CI completes for Dependabot and Cycode PRs.
4+
# It handles squash merge AND notifications in sequence.
5+
6+
on:
7+
workflow_run:
8+
workflows: ["CI"]
9+
types:
10+
- completed
11+
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
jobs:
17+
process-dependency-update:
18+
name: Process Dependency Update PR
19+
runs-on: ubuntu-latest
20+
if: |
21+
(github.event.workflow_run.actor.login == 'dependabot[bot]' ||
22+
github.event.workflow_run.actor.login == 'cycode-security[bot]') &&
23+
github.event.workflow_run.event == 'pull_request'
24+
25+
steps:
26+
- name: Get PR information
27+
id: pr
28+
uses: actions/github-script@v8
29+
with:
30+
script: |
31+
const { data: pullRequests } = await github.rest.pulls.list({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
state: 'open',
35+
head: `${context.repo.owner}:${context.payload.workflow_run.head_branch}`
36+
});
37+
38+
if (pullRequests.length > 0) {
39+
const pr = pullRequests[0];
40+
core.setOutput('number', pr.number);
41+
core.setOutput('title', pr.title);
42+
core.setOutput('url', pr.html_url);
43+
core.setOutput('found', 'true');
44+
core.setOutput('author', pr.user.login);
45+
46+
// Check if major update from PR title
47+
const majorPattern = /from \d+\.\d+\.\d+ to (\d+)\./;
48+
const match = pr.title.match(majorPattern);
49+
if (match) {
50+
const fromMajor = pr.title.match(/from (\d+)\./);
51+
const toMajor = match[1];
52+
core.setOutput('is_major', fromMajor && fromMajor[1] !== toMajor ? 'true' : 'false');
53+
} else {
54+
core.setOutput('is_major', 'false');
55+
}
56+
57+
console.log(`Found PR #${pr.number}: ${pr.title}`);
58+
} else {
59+
core.setOutput('found', 'false');
60+
console.log('No matching PR found');
61+
}
62+
63+
- name: Notify Slack - CI Failed
64+
if: |
65+
github.event.workflow_run.conclusion == 'failure' &&
66+
steps.pr.outputs.found == 'true'
67+
run: |
68+
curl -X POST -H 'Content-type: application/json' --data '{
69+
"attachments": [{
70+
"color": "#ff0000",
71+
"blocks": [
72+
{"type": "header", "text": {"type": "plain_text", "text": "🚨 Dependency Update - CI Failed"}},
73+
{"type": "section", "fields": [
74+
{"type": "mrkdwn", "text": "*Repository:*\n${{ github.repository }}"},
75+
{"type": "mrkdwn", "text": "*PR:*\n<${{ steps.pr.outputs.url }}|#${{ steps.pr.outputs.number }}>"}
76+
]},
77+
{"type": "section", "text": {"type": "mrkdwn", "text": "*Author:* ${{ steps.pr.outputs.author }}\n${{ steps.pr.outputs.title }}\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}|View CI Run>"}}
78+
]
79+
}]
80+
}' "$SLACK_WEBHOOK"
81+
env:
82+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
83+
84+
- name: Notify Slack - Major Update
85+
if: |
86+
github.event.workflow_run.conclusion == 'success' &&
87+
steps.pr.outputs.found == 'true' &&
88+
steps.pr.outputs.is_major == 'true'
89+
run: |
90+
curl -X POST -H 'Content-type: application/json' --data '{
91+
"attachments": [{
92+
"color": "#ffa500",
93+
"blocks": [
94+
{"type": "header", "text": {"type": "plain_text", "text": "⚠️ Major Update - Manual Review Required"}},
95+
{"type": "section", "fields": [
96+
{"type": "mrkdwn", "text": "*Repository:*\n${{ github.repository }}"},
97+
{"type": "mrkdwn", "text": "*PR:*\n<${{ steps.pr.outputs.url }}|#${{ steps.pr.outputs.number }}>"}
98+
]},
99+
{"type": "section", "text": {"type": "mrkdwn", "text": "*Author:* ${{ steps.pr.outputs.author }}\n${{ steps.pr.outputs.title }}\n\nReview changelog for breaking changes."}}
100+
]
101+
}]
102+
}' "$SLACK_WEBHOOK"
103+
env:
104+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
105+
106+
- name: Squash merge PR
107+
id: merge
108+
if: |
109+
github.event.workflow_run.conclusion == 'success' &&
110+
steps.pr.outputs.found == 'true' &&
111+
steps.pr.outputs.is_major != 'true'
112+
run: |
113+
if gh pr merge ${{ steps.pr.outputs.number }} --squash --repo ${{ github.repository }}; then
114+
echo "result=success" >> $GITHUB_OUTPUT
115+
else
116+
echo "result=failed" >> $GITHUB_OUTPUT
117+
fi
118+
env:
119+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
121+
- name: Notify Slack - Squash Merged
122+
if: |
123+
github.event.workflow_run.conclusion == 'success' &&
124+
steps.pr.outputs.found == 'true' &&
125+
steps.pr.outputs.is_major != 'true' &&
126+
steps.merge.outputs.result == 'success'
127+
run: |
128+
curl -X POST -H 'Content-type: application/json' --data '{
129+
"attachments": [{
130+
"color": "#36a64f",
131+
"blocks": [
132+
{"type": "header", "text": {"type": "plain_text", "text": "✅ Dependency Update - Squash Merged"}},
133+
{"type": "section", "fields": [
134+
{"type": "mrkdwn", "text": "*Repository:*\n${{ github.repository }}"},
135+
{"type": "mrkdwn", "text": "*PR:*\n<${{ steps.pr.outputs.url }}|#${{ steps.pr.outputs.number }}>"}
136+
]},
137+
{"type": "section", "text": {"type": "mrkdwn", "text": "*Author:* ${{ steps.pr.outputs.author }}\n${{ steps.pr.outputs.title }}"}}
138+
]
139+
}]
140+
}' "$SLACK_WEBHOOK"
141+
env:
142+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
143+
144+
- name: Notify Slack - Merge Failed
145+
if: |
146+
github.event.workflow_run.conclusion == 'success' &&
147+
steps.pr.outputs.found == 'true' &&
148+
steps.pr.outputs.is_major != 'true' &&
149+
steps.merge.outputs.result == 'failed'
150+
run: |
151+
curl -X POST -H 'Content-type: application/json' --data '{
152+
"attachments": [{
153+
"color": "#ff0000",
154+
"blocks": [
155+
{"type": "header", "text": {"type": "plain_text", "text": "🚨 Merge Failed"}},
156+
{"type": "section", "fields": [
157+
{"type": "mrkdwn", "text": "*Repository:*\n${{ github.repository }}"},
158+
{"type": "mrkdwn", "text": "*PR:*\n<${{ steps.pr.outputs.url }}|#${{ steps.pr.outputs.number }}>"}
159+
]},
160+
{"type": "section", "text": {"type": "mrkdwn", "text": "*Author:* ${{ steps.pr.outputs.author }}\n${{ steps.pr.outputs.title }}\n\nCould not merge PR. Manual intervention required."}}
161+
]
162+
}]
163+
}' "$SLACK_WEBHOOK"
164+
env:
165+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
166+
167+
notify-merged:
168+
name: Notify Merged
169+
runs-on: ubuntu-latest
170+
if: |
171+
github.event.workflow_run.conclusion == 'success' &&
172+
github.event.workflow_run.event == 'push' &&
173+
(contains(github.event.workflow_run.head_commit.message, 'dependabot') ||
174+
contains(github.event.workflow_run.head_commit.message, 'cycode'))
175+
steps:
176+
- name: Send Slack notification
177+
run: |
178+
curl -X POST -H 'Content-type: application/json' --data '{
179+
"attachments": [{
180+
"color": "#2eb886",
181+
"blocks": [
182+
{"type": "header", "text": {"type": "plain_text", "text": "🎉 Dependencies Updated Successfully"}},
183+
{"type": "section", "fields": [
184+
{"type": "mrkdwn", "text": "*Repository:*\n${{ github.repository }}"},
185+
{"type": "mrkdwn", "text": "*Commit:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.event.workflow_run.head_sha }}|View>"}
186+
]}
187+
]
188+
}]
189+
}' "$SLACK_WEBHOOK"
190+
env:
191+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
192+

0 commit comments

Comments
 (0)