Skip to content

Commit 9166f2f

Browse files
SCANPY-220 Migrate the mac os qa and its tasks (#288)
1 parent 1fad02b commit 9166f2f

4 files changed

Lines changed: 130 additions & 7 deletions

File tree

.github/actions/config-poetry/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ runs:
3737
- uses: SonarSource/ci-github-actions/get-build-number@v1
3838
id: get_build_number
3939
- name: Cache local Poetry cache
40-
uses: SonarSource/ci-github-actions/cache@v1
40+
uses: SonarSource/gh-action_cache@v1
4141
with:
4242
path: ${{ inputs.poetry-cache-dir }}
43-
key: poetry-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
44-
restore-keys: poetry-${{ runner.os }}-
43+
key: poetry-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}
44+
restore-keys: |
45+
poetry-${{ runner.os }}-${{ inputs.python-version }}-
46+
poetry-${{ runner.os }}-
4547
4648
# python needs to be installed before jfrog and poetry
4749
# (see https://xtranet-sonarsource.atlassian.net/wiki/spaces/Platform/pages/4344217683/Mise+Poetry+Install+-+GitHub)

.github/workflows/MacOsNightly.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: macOS Nightly Build
2+
3+
on:
4+
schedule:
5+
# Run at 3:00 AM UTC every day (5:00 AM CEST / 4:00 AM CET)
6+
- cron: "0 3 * * *"
7+
workflow_dispatch:
8+
inputs:
9+
skip_its:
10+
description: "Skip integration tests"
11+
required: false
12+
default: false
13+
type: boolean
14+
15+
# Only allow one instance of this workflow to run at a time
16+
concurrency:
17+
group: ${{ github.workflow }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
qa-macos:
22+
name: "Test macOS Python ${{ matrix.python-version }}"
23+
runs-on: macos-latest-xlarge
24+
permissions:
25+
id-token: write
26+
contents: read
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
python-version: ["3.9.18", "3.10.13", "3.11.7", "3.12.1", "3.13.2"]
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
34+
35+
- name: Setup Cloudflare WARP
36+
uses: SonarSource/gh-action_setup-cloudflare-warp@v1
37+
38+
- name: Configure poetry
39+
uses: ./.github/actions/config-poetry
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
43+
- name: Execute the test suite
44+
run: poetry run pytest tests/
45+
46+
its-macos:
47+
name: "macOS Integration Tests"
48+
runs-on: macos-latest-xlarge
49+
if: ${{ !inputs.skip_its }}
50+
permissions:
51+
id-token: write
52+
contents: read
53+
env:
54+
SONARQUBE_VERSION: 25.3.0.104237
55+
SKIP_DOCKER: true
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
59+
60+
- name: Setup Cloudflare WARP
61+
uses: SonarSource/gh-action_setup-cloudflare-warp@v1
62+
63+
- name: Cache SonarQube
64+
uses: SonarSource/gh-action_cache@v1
65+
id: sonarqube-cache
66+
with:
67+
path: sonarqube_cache/
68+
key: sonarqube-macos-${{ env.SONARQUBE_VERSION }}
69+
restore-keys: sonarqube-macos-
70+
71+
- name: Download SonarQube
72+
if: ${{ !steps.sonarqube-cache.outputs.cache-hit }}
73+
run: |
74+
mkdir -p sonarqube_cache
75+
if [ ! -f sonarqube_cache/sonarqube.zip ]; then
76+
wget -q https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-$SONARQUBE_VERSION.zip -O sonarqube_cache/sonarqube.zip
77+
fi
78+
79+
- name: Configure poetry
80+
uses: ./.github/actions/config-poetry
81+
82+
- name: Execute the integration tests
83+
run: ./.github/scripts/run_its.sh
84+
85+
notify-on-failure:
86+
name: "Notify on Failure"
87+
runs-on: ubuntu-latest
88+
permissions:
89+
id-token: write
90+
contents: read
91+
needs: [qa-macos, its-macos]
92+
if: failure() && github.event_name == 'schedule'
93+
steps:
94+
- name: Write failure summary
95+
run: |
96+
echo "## macOS Nightly Build Failed" >> $GITHUB_STEP_SUMMARY
97+
echo "" >> $GITHUB_STEP_SUMMARY
98+
echo "The scheduled macOS nightly build has failed." >> $GITHUB_STEP_SUMMARY
99+
echo "" >> $GITHUB_STEP_SUMMARY
100+
echo "**Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
101+
102+
- name: Vault Secrets
103+
id: secrets
104+
uses: SonarSource/vault-action-wrapper@v3
105+
with:
106+
secrets: |
107+
development/kv/data/slack token | SLACK_TOKEN;
108+
109+
- name: Send Slack notification
110+
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2.3.3
111+
env:
112+
SLACK_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SLACK_TOKEN }}
113+
SLACK_CHANNEL: squad-python-notifs
114+
SLACK_COLOR: danger
115+
SLACK_TITLE: Build Failed
116+
SLACK_MESSAGE: |
117+
Workflow failed in ${{ github.repository }} 🚨
118+
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
119+
SLACK_USERNAME: BuildBot
120+

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,17 @@ jobs:
174174
contents: write
175175
env:
176176
SONARQUBE_VERSION: 25.3.0.104237
177+
SKIP_DOCKER: true
177178
steps:
178179
- name: Checkout repository
179180
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
180181
- name: Cache SonarQube
181-
uses: SonarSource/ci-github-actions/cache@v1
182+
uses: SonarSource/gh-action_cache@v1
182183
id: sonarqube-cache
183184
with:
184185
path: sonarqube_cache/
185-
key: sonarqube-25.3.0.104237
186-
restore-keys: cache-${{ runner.os }}-
186+
key: sonarqube-${{ env.SONARQUBE_VERSION }}
187+
restore-keys: sonarqube-
187188
- name: Download SonarQube
188189
if: ${{ !steps.sonarqube-cache.outputs.cache-hit }}
189190
run: |

tests/its/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def check_health(sonarqube_client: SonarQubeClient) -> bool:
3838
return False
3939

4040

41-
if "CIRRUS_OS" in os.environ:
41+
if "SKIP_DOCKER" in os.environ:
4242
from time import sleep
4343

4444
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)