forked from ansible/django-ansible-base
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (77 loc) · 2.86 KB
/
ci.yml
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
---
name: CI
on:
pull_request:
push:
jobs:
tox:
name: django-ansible-base - ${{ matrix.tests.env }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
tests:
- env: check
python-version: "3.11"
sonar: false
junit-xml-upload: false
- env: py39
python-version: "3.9"
sonar: false
junit-xml-upload: false
- env: py310
python-version: "3.10"
sonar: false
junit-xml-upload: false
- env: py311
python-version: "3.11"
sonar: true
junit-xml-upload: true
- env: py311sqlite
python-version: "3.11"
sonar: false
junit-xml-upload: false
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Install build requirements
run: sudo apt-get update && sudo apt-get install -y libsasl2-dev libldap2-dev libssl-dev libxmlsec1-dev
- name: Install python ${{ matrix.tests.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.tests.python-version }}
- name: Install tox
run: pip${{ matrix.tests.python-version }} install tox
- name: Run tox
run: |
echo "::remove-matcher owner=python::" # Disable annoying annotations from setup-python
tox -e ${{ matrix.tests.env }}
- name: Inject PR number into coverage.xml
if: matrix.tests.sonar
run: sed -i '2i <!-- PR ${{ github.event.number }} -->' coverage.xml
- name: Upload coverage as artifact
uses: actions/upload-artifact@v4
if: matrix.tests.sonar
with:
name: coverage
path: coverage.xml
- name: SonarCloud Scan (on push)
uses: SonarSource/sonarcloud-github-action@master
if: matrix.tests.sonar && github.event_name == 'push' && github.repository == 'ansible/django-ansible-base'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload jUnit XML test results
if: matrix.tests.junit-xml-upload && github.event_name == 'push' && github.repository == 'ansible/django-ansible-base' && github.ref_name == 'devel'
continue-on-error: true
run: >-
curl -v --user "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}"
--form "[email protected]"
--form "component_name=django-ansible-base"
--form "git_commit_sha=${{ github.sha }}"
--form "git_repository_url=https://github.com/${{ github.repository }}"
"${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/"