Skip to content

Commit 1990eb9

Browse files
authored
fix issues (#78)
* fix issues * fix issues * fix issues
1 parent 5457536 commit 1990eb9

Some content is hidden

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

47 files changed

+1542
-96
lines changed

.github/workflows/dependabot-auto-merge.yml

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ permissions:
1212
contents: write
1313
pull-requests: write
1414

15+
concurrency:
16+
group: dependabot-auto-merge-${{ github.event.pull_request.number }}
17+
cancel-in-progress: true
18+
1519
jobs:
1620
auto-merge:
21+
name: dependabot-auto-merge
1722
if: github.actor == 'dependabot[bot]' && github.event.pull_request.draft == false
1823
runs-on: ubuntu-latest
1924
steps:
@@ -25,32 +30,70 @@ jobs:
2530

2631
- name: Evaluate update type
2732
id: eligibility
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
PR_NUMBER: ${{ github.event.pull_request.number }}
36+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
37+
UPDATE_TYPE: ${{ steps.metadata.outputs.update-type }}
2838
run: |
29-
update_type="${{ steps.metadata.outputs.update-type }}"
30-
case "$update_type" in
31-
version-update:semver-patch|version-update:semver-minor)
32-
echo "eligible=true" >> "$GITHUB_OUTPUT"
33-
;;
34-
*)
35-
echo "eligible=false" >> "$GITHUB_OUTPUT"
36-
;;
37-
esac
38-
echo "update_type=$update_type" >> "$GITHUB_OUTPUT"
39+
set -euo pipefail
40+
update_type="${UPDATE_TYPE}"
41+
eligible=false
42+
reason=""
43+
44+
is_allowed_path() {
45+
local path="$1"
46+
[[ "${path}" =~ ^\.github/workflows/[^/]+\.ya?ml$ ]] || \
47+
[[ "${path}" =~ ^\.github/actions/.+/action\.ya?ml$ ]]
48+
}
49+
50+
if [[ "${HEAD_REF}" != dependabot/github_actions/* ]]; then
51+
reason="Dependabot PR is not from the github-actions ecosystem (${HEAD_REF})."
52+
else
53+
mapfile -t files < <(gh pr view "${PR_NUMBER}" --repo "${GITHUB_REPOSITORY}" --json files --jq '.files[].path')
54+
if [[ "${#files[@]}" -eq 0 ]]; then
55+
reason="Dependabot PR has no changed files."
56+
else
57+
for path in "${files[@]}"; do
58+
if ! is_allowed_path "${path}"; then
59+
reason="Changed file '${path}' is outside workflow automation scope."
60+
eligible=false
61+
break
62+
fi
63+
done
64+
65+
if [[ -z "${reason}" ]]; then
66+
eligible=true
67+
fi
68+
fi
69+
fi
70+
71+
echo "eligible=${eligible}" >> "$GITHUB_OUTPUT"
72+
echo "update_type=${update_type}" >> "$GITHUB_OUTPUT"
73+
echo "reason=${reason}" >> "$GITHUB_OUTPUT"
3974
4075
- name: Auto-approve Dependabot update
76+
if: steps.eligibility.outputs.eligible == 'true'
4177
env:
4278
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
run: gh pr review --approve "${{ github.event.pull_request.html_url }}"
79+
PR_URL: ${{ github.event.pull_request.html_url }}
80+
run: gh pr review --approve "${PR_URL}"
4481

4582
- name: Enable auto-merge
4683
if: steps.eligibility.outputs.eligible == 'true'
4784
env:
4885
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
run: gh pr merge --auto "${{ github.event.pull_request.html_url }}"
86+
PR_URL: ${{ github.event.pull_request.html_url }}
87+
run: gh pr merge --auto --squash "${PR_URL}"
5088

51-
- name: Skip auto-merge for non patch/minor updates
89+
- name: Skip auto-merge for non-workflow or non-github-actions updates
5290
if: steps.eligibility.outputs.eligible != 'true'
91+
env:
92+
DEPENDENCY_NAMES: ${{ steps.metadata.outputs.dependency-names }}
93+
UPDATE_TYPE: ${{ steps.metadata.outputs.update-type }}
94+
REASON: ${{ steps.eligibility.outputs.reason }}
5395
run: |
5496
echo "Skipping auto-merge for Dependabot update."
55-
echo "Dependency names: ${{ steps.metadata.outputs.dependency-names }}"
56-
echo "Update type: ${{ steps.metadata.outputs.update-type }}"
97+
echo "Dependency names: ${DEPENDENCY_NAMES}"
98+
echo "Update type: ${UPDATE_TYPE}"
99+
echo "Reason: ${REASON}"

.github/workflows/mysterybox-bridge-charts-ci.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ on:
55
paths:
66
- "services/mysterybox-bridge/charts/**"
77
- ".github/workflows/mysterybox-bridge-charts-ci.yml"
8+
push:
9+
branches: ["main"]
10+
paths:
11+
- "services/mysterybox-bridge/charts/**"
12+
- ".github/workflows/mysterybox-bridge-charts-ci.yml"
13+
workflow_dispatch:
814

915
permissions:
1016
contents: read
1117

1218
concurrency:
13-
group: mysterybox-bridge-chart-lint-and-tests-${{ github.ref }}
19+
group: mysterybox-bridge-chart-lint-and-tests-${{ github.workflow }}-${{ github.ref }}
1420
cancel-in-progress: true
1521

1622
jobs:
@@ -31,9 +37,19 @@ jobs:
3137
- name: Set up chart-testing
3238
uses: helm/chart-testing-action@v2.8.0
3339

34-
- name: Run ct lint
40+
- name: Run ct lint for changed charts
41+
if: github.event_name == 'pull_request'
42+
env:
43+
TARGET_BRANCH: ${{ github.base_ref }}
44+
run: |
45+
set -euo pipefail
46+
ct lint --config services/mysterybox-bridge/charts/ct.yaml --target-branch "${TARGET_BRANCH}"
47+
48+
- name: Run ct lint for all charts
49+
if: github.event_name != 'pull_request'
3550
run: |
36-
ct lint --config services/mysterybox-bridge/charts/ct.yaml --target-branch "${{ github.base_ref }}"
51+
set -euo pipefail
52+
ct lint --config services/mysterybox-bridge/charts/ct.yaml --all
3753
3854
render-snapshots:
3955
name: mysterybox-bridge-render-snapshot-tests
@@ -42,11 +58,20 @@ jobs:
4258
steps:
4359
- name: Checkout
4460
uses: actions/checkout@v6
61+
with:
62+
fetch-depth: 0
63+
64+
- name: Set up Python
65+
uses: actions/setup-python@v6
66+
with:
67+
python-version: "3.12"
4568

4669
- name: Set up Helm
4770
uses: azure/setup-helm@v4
4871
with:
4972
version: v3.15.4
5073

5174
- name: Verify chart render snapshots
52-
run: python3 services/mysterybox-bridge/charts/tests/all_tests.py
75+
run: |
76+
set -euo pipefail
77+
python3 services/mysterybox-bridge/charts/tests/all_tests.py

.github/workflows/mysterybox-bridge-image.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
name: mysterybox-bridge-image
22

33
on:
4+
pull_request:
5+
paths:
6+
- "services/mysterybox-bridge/webhook/**"
7+
- ".github/workflows/mysterybox-bridge-image.yml"
48
push:
59
branches: ["main"]
610
tags:
711
- "mysterybox-bridge-v*"
812
paths:
913
- "services/mysterybox-bridge/webhook/**"
14+
- ".github/workflows/mysterybox-bridge-image.yml"
1015
workflow_dispatch:
1116
inputs:
1217
source_ref:
@@ -28,7 +33,7 @@ permissions:
2833
contents: read
2934

3035
concurrency:
31-
group: mysterybox-bridge-image-${{ github.ref }}
36+
group: mysterybox-bridge-image-${{ github.workflow }}-${{ github.ref }}
3237
cancel-in-progress: true
3338

3439
env:
@@ -37,7 +42,7 @@ env:
3742

3843
jobs:
3944
test:
40-
name: lint-and-test
45+
name: mysterybox-bridge-lint-and-test
4146
runs-on: ubuntu-latest
4247
defaults:
4348
run:
@@ -46,6 +51,7 @@ jobs:
4651
- name: Checkout
4752
uses: actions/checkout@v6
4853
with:
54+
fetch-depth: 0
4955
ref: ${{ inputs.source_ref || github.ref }}
5056

5157
- name: Set up Python
@@ -55,25 +61,31 @@ jobs:
5561

5662
- name: Install dependencies
5763
run: |
64+
set -euo pipefail
5865
python -m pip install --upgrade pip
5966
pip install -e ".[dev]"
6067
6168
- name: Lint
6269
run: python -m ruff check src tests
6370

64-
- name: Test
65-
run: python -m pytest -q tests
71+
- name: Unit tests
72+
run: python -m pytest -q -m "not integration" tests/unit
73+
74+
- name: Integration smoke tests
75+
run: python -m pytest -q -m integration tests/integration
6676

6777
build-and-push:
68-
name: build-and-push
78+
name: mysterybox-bridge-build-and-push
6979
runs-on: ubuntu-latest
80+
if: github.event_name != 'pull_request'
7081
needs: [test]
7182
environment:
7283
name: mysterybox-image-publish
7384
steps:
7485
- name: Checkout
7586
uses: actions/checkout@v6
7687
with:
88+
fetch-depth: 0
7789
ref: ${{ inputs.source_ref || github.ref }}
7890

7991
- name: Authorize workflow_dispatch actor
@@ -110,11 +122,17 @@ jobs:
110122
exit 1
111123
fi
112124
113-
if [[ "${PUBLISH_LATEST}" == "true" && "${SOURCE_REF}" != "main" ]]; then
125+
if [[ "${PUBLISH_LATEST}" == "true" && "${SOURCE_REF}" != "main" && "${SOURCE_REF}" != "refs/heads/main" ]]; then
114126
echo "::error::publish_latest=true is only allowed with source_ref=main"
115127
exit 1
116128
fi
117129
130+
- name: Resolve source commit
131+
id: source
132+
run: |
133+
set -euo pipefail
134+
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
135+
118136
- name: Set up Docker Buildx
119137
uses: docker/setup-buildx-action@v4
120138

@@ -155,7 +173,7 @@ jobs:
155173
EVENT_NAME: ${{ github.event_name }}
156174
REF_NAME: ${{ github.ref_name }}
157175
REF_TYPE: ${{ github.ref_type }}
158-
SHA: ${{ github.sha }}
176+
SHA: ${{ steps.source.outputs.sha }}
159177
RELEASE_VERSION: ${{ inputs.release_version }}
160178
PUBLISH_LATEST: ${{ inputs.publish_latest }}
161179
run: |
@@ -218,7 +236,7 @@ jobs:
218236
--arg event "${GITHUB_EVENT_NAME}" \
219237
--arg ref "${GITHUB_REF}" \
220238
--arg ref_name "${GITHUB_REF_NAME}" \
221-
--arg sha "${GITHUB_SHA}" \
239+
--arg sha "${{ steps.source.outputs.sha }}" \
222240
--arg digest "${IMAGE_DIGEST}" \
223241
--arg run_id "${GITHUB_RUN_ID}" \
224242
--arg run_attempt "${GITHUB_RUN_ATTEMPT}" \
@@ -255,7 +273,7 @@ jobs:
255273
echo "- Actor: \`${GITHUB_ACTOR}\`"
256274
echo "- Event: \`${GITHUB_EVENT_NAME}\`"
257275
echo "- Ref: \`${GITHUB_REF}\`"
258-
echo "- Commit: \`${GITHUB_SHA}\`"
276+
echo "- Commit: \`${{ steps.source.outputs.sha }}\`"
259277
echo "- Digest: \`${IMAGE_DIGEST}\`"
260278
echo ""
261279
echo "#### Tags"

.github/workflows/nebius-cxcli-ci.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,47 @@ on:
55
paths:
66
- "services/nebius-cxcli/**"
77
- ".github/workflows/nebius-cxcli-ci.yml"
8+
- ".github/workflows/nebius-cxcli-release.yml"
89
push:
910
branches: [main]
1011
paths:
1112
- "services/nebius-cxcli/**"
1213
- ".github/workflows/nebius-cxcli-ci.yml"
14+
- ".github/workflows/nebius-cxcli-release.yml"
15+
workflow_dispatch:
1316

1417
permissions:
1518
contents: read
1619

20+
concurrency:
21+
group: nebius-cxcli-ci-${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
1724
jobs:
18-
test:
25+
verify:
26+
name: nebius-cxcli-ci
1927
runs-on: ubuntu-latest
2028
defaults:
2129
run:
2230
working-directory: services/nebius-cxcli
2331
steps:
2432
- uses: actions/checkout@v6
33+
with:
34+
fetch-depth: 0
2535
- uses: actions/setup-python@v6
2636
with:
2737
python-version: "3.12"
2838
- name: Install dependencies
2939
run: |
40+
set -euo pipefail
3041
python -m pip install --upgrade pip
3142
pip install -e ".[dev]"
3243
- name: Lint
3344
run: python -m ruff check src tests
3445
- name: Test
3546
run: python -m pytest -q
47+
- name: Build wheel
48+
run: |
49+
set -euo pipefail
50+
rm -rf build dist
51+
python -m build --wheel

0 commit comments

Comments
 (0)