-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (103 loc) · 3.77 KB
/
python-app.yml
File metadata and controls
132 lines (103 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [main, develop, feature/*, release/*]
pull_request:
branches: [main, develop, feature/*, release/*]
types: [opened, synchronize, reopened]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pdm install -d -G lint -G typecheck
- name: Lint
run: pdm run lint
- name: Typecheck
run: pdm run typecheck
unit_and_integration_tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Install docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pdm install -dG dev
- name: Test with pytest
run: |
pdm run coverage run --source=hpcrocket -m pytest -m "not acceptance" test/
pdm run coverage xml
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.python }}
path: coverage.xml
# acceptance_test:
# runs-on: ubuntu-latest
# env:
# TARGET_HOST: ${{ secrets.TARGET_HOST }}
# TARGET_USER: ${{ secrets.TARGET_USER }}
# PROXY_HOST: ${{ secrets.PROXY_HOST }}
# PROXY_USER: ${{ secrets.PROXY_USER }}
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python 3.10
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# if [ -f testrequirements.txt ]; then pip install -r testrequirements.txt; fi
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# - name: Install SSH keys
# run: |
# mkdir -p $GITHUB_WORKSPACE/.ssh
# touch $GITHUB_WORKSPACE/.ssh/proxy_key
# touch $GITHUB_WORKSPACE/.ssh/target_key
# echo "${{ secrets.PROXY_SECRET }}" >> $GITHUB_WORKSPACE/.ssh/proxy_key
# echo "${{ secrets.TARGET_SECRET }}" >> $GITHUB_WORKSPACE/.ssh/target_key
# - name: Test with pytest
# run: |
# export PROXY_KEY="$GITHUB_WORKSPACE/.ssh/proxy_key"
# export TARGET_KEY="$GITHUB_WORKSPACE/.ssh/target_key"
# export ABS_DIR="$GITHUB_WORKSPACE/test/testconfig"
# export REMOTE_SLURM_SCRIPT="slurm.job"
# echo $PROXY_KEY $TARGET_KEY
# coverage run --source=hpcrocket -m pytest -m "acceptance" test/
sonarcloud:
name: SonarCloud
needs: unit_and_integration_tests
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.13"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: code-coverage-report-${{ env.PYTHON_VERSION }}
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}