-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 2.07 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:
workflow_dispatch:
inputs:
upload_artifacts:
description: 'Upload build artifacts'
required: true
default: false
type: boolean
push:
branches:
- main
- 'release/v**'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
release:
types:
- published
permissions:
contents: write
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
DISPLAY: :99
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Xvfb (Linux only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y
sudo apt-get install -y xvfb
Xvfb -ac $DISPLAY -screen 0 1280x1024x24 > /dev/null 2>&1 &
- name: Test with pytest
run: |
coverage run --branch -m pytest tests
coverage xml
coverage report
- name: SonarCloud Scan (Linux only)
if: matrix.os == 'ubuntu-latest'
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build application with PyInstaller
run: pyinstaller -y yagat.spec
- name: Upload application Artifact
if: ${{ github.event_name == 'workflow_dispatch' && inputs.upload_artifacts }}
uses: actions/upload-artifact@v4
with:
name: yagat-${{ matrix.os }}
path: dist/yagat*
- name: Upload release package
if: ${{ github.event_name == 'release' }}
uses: softprops/[email protected]
with:
files: yagat_*_*.zip