github/workflows: update dependencies and enable python-is-python3
[git-cola.git] / .github / workflows / main.yml
blobcf5ec83b7e460255b0242bc94aa9c3ac72ac01d3
1 name: CI
3 on: [push, pull_request]
5 jobs:
6   build:
7     name: 'Build'
8     runs-on: ubuntu-latest
9     steps:
10       - name: Checkout
11         uses: actions/checkout@v2
12         # Repository checked out under $GITHUB_WORKSPACE
14       - name: Install Dependencies
15         run: |
16           sudo apt-get update
17           sudo apt-get install \
18               gettext \
19               python3-sphinx
21       - name: Build
22         run: make prefix="build" install
24       - name: Upload Artifact
25         uses: actions/upload-artifact@v2
26         with:
27           name: git-cola-run${{github.run_number}}-${{runner.os}}
28           path: build/
30   test:
31     name: 'Test'
32     runs-on: ubuntu-latest
33     steps:
34       - name: Checkout
35         uses: actions/checkout@v2
36         # Repository checked out under $GITHUB_WORKSPACE
38       - name: Install Dependencies
39         run: |
40           sudo apt-get update
41           sudo apt-get install \
42               black \
43               gettext \
44               flake8 \
45               pylint \
46               python-is-python3 \
47               python-pytest \
48               python3-pytest \
49               python3-pytest-flake8
50           # Runtime dependencies (required)
51           sudo apt-get install \
52               python3-qtpy \
53               python3-pyqt5
54           # Runtime dependencies (optional)
55           sudo apt-get install \
56               python3-send2trash
57           # Development environment
58           make requirements-dev
59           # These requirements are already satisfied by python3-send2trash.
60           # make requirements-optional
62       - name: Build Translations
63         run: make i18n
65       - name: Run Unit Tests
66         run: |
67           git config --global user.name "Git Cola"
68           git config --global user.email git-cola@localhost
69           make test
71       - name: Run Linter
72         run: make pylint color=0
74       - name: Check Code Style
75         run: make flake8
77       - name: Check Code Formatting
78         # For strict adherence to formatting, run 'black' with --check
79         run: make format
81   win32:
82     name: 'Build / win32'
83     runs-on: windows-latest
84     steps:
85       - name: Checkout
86         uses: actions/checkout@v2
87         # Repository checked out under $GITHUB_WORKSPACE
89       - name: Setup Python
90         uses: actions/setup-python@v2
91         with:
92           python-version: '3.x'
93           architecture: 'x64'
95       - name: Pip Cache
96         uses: actions/cache@v2
97         with:
98             path: ~\AppData\Local\pip\Cache
99             key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements/requirements*.txt') }}
101       - name: Install Dependencies
102         run: |
103           pip install PyQt5
104           pip install qtpy
105           pip install --requirement requirements/requirements-dev.txt
106           pip install --requirement requirements/requirements-maint.txt
108       # Based on: contrib/win32/run-pynsist.sh
109       - name: Build Installer
110         run: |
111           make all
112           make doc
113           make htmldir="$PWD/share/doc/git-cola/html" install-doc
114           pynsist pynsist.cfg
115           rm -r share/doc/git-cola/html
117           # Rename executable output
118           cd build\nsis
119           mv git-cola*.exe git-cola-run${{github.run_number}}.exe
121       - name: Upload Artifact
122         uses: actions/upload-artifact@v2
123         with:
124           name: git-cola-run${{github.run_number}}-${{runner.os}}
125           path: build\nsis\git-cola*.exe
127   darwin:
128     name: 'Build / darwin'
129     runs-on: macos-latest
130     steps:
131       - name: Checkout
132         uses: actions/checkout@v2
133         # Repository checked out under $GITHUB_WORKSPACE
135       - name: Install Dependencies
136         run: |
137           brew install sphinx-doc
138           brew install git-cola
140       - name: Build Bundle
141         run: |
142           mkdir build
143           make \
144             PYTHON=$(brew --prefix python3)/bin/python3 \
145             PYTHON_CONFIG=$(brew --prefix python3)/bin/python3-config \
146             SPHINXBUILD=$(brew --prefix sphinx-doc)/bin/sphinx-build \
147             git-cola.app
148           mv git-cola.app build/
150       - name: Upload Artifact
151         uses: actions/upload-artifact@v2
152         with:
153           name: git-cola-run${{github.run_number}}-${{runner.os}}
154           path: build/