ci: pin sphinx versions and fix the macos/app recipe
[git-cola.git] / .github / workflows / ci.yml
blob498bbca7fc58b27ce464dc462fe693e81677b2fe
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@v3
12       - name: Install Rust
13         run: rustup toolchain install stable --profile minimal --no-self-update
14       - name: Install Garden
15         run: cargo install garden-tools
16       - uses: Swatinem/rust-cache@v2
17       - name: Install build dependencies
18         run: |
19           set -x
20           sudo apt-get update
21           sudo apt-get install python3-sphinx python3-qtpy python3-pyqt5
22       - name: Install Git Cola
23         run: garden -D prefix=dist install
25   test:
26     name: Test
27     runs-on: ubuntu-latest
28     steps:
29       - name: Checkout
30         uses: actions/checkout@v3
31       - name: Install Rust
32         run: rustup toolchain install stable --profile minimal --no-self-update
33       - name: Install Garden
34         run: cargo install garden-tools
35       - uses: Swatinem/rust-cache@v2
36       - name: Install Dependencies
37         run: |
38           set -x
39           sudo apt-get update
40           # Runtime dependencies (required)
41           sudo apt-get install \
42               python3-qtpy \
43               python3-pyqt5
44           # Runtime dependencies (optional)
45           sudo apt-get install \
46               python3-send2trash
47           # Development dependencies
48           sudo apt-get install \
49               pylint \
50               python-is-python3 \
51               python3-pytest \
52               python3-setuptools-scm \
53               python3-sphinx
54           pip install brunette
55       - name: Configure tests
56         run: |
57           git config --global user.name "Git Cola"
58           git config --global user.email git-cola@localhost
59       - name: Run tests and checks
60         run: garden check
61       - name: Code formatting
62         run: garden fmt -- --check
64   windows:
65     name: Windows
66     runs-on: windows-latest
67     steps:
68       - name: Checkout
69         uses: actions/checkout@v3
70       - name: Setup Python
71         uses: actions/setup-python@v4
72         with:
73           python-version: '3.x'
74           architecture: x64
75       - name: Pip Cache
76         uses: actions/cache@v3
77         with:
78           path: ~/AppData/Local/pip/Cache
79           key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements/requirements*.txt') }}
80       - name: Install Dependencies
81         run: |
82           pip install wheel
83           pip install Sphinx==5.3.0
84           pip install --requirement requirements/requirements.txt
85           pip install --requirement requirements/requirements-opt.txt
86           pip install --requirement requirements/requirements-dev.txt
87           pip install --requirement requirements/requirements-maint.txt
88       # Based on: contrib/win32/run-pynsist.sh
89       - name: Build Installer
90         run: |
91           make doc
92           make htmldir="$PWD/share/doc/git-cola/html" install-doc
93           pynsist pynsist.cfg
94           rm -r share/doc/git-cola/html
96           # Rename executable output
97           cd build/nsis
98           mv git-cola*.exe git-cola-latest-${{github.run_number}}.exe
99       - name: Upload Artifact
100         uses: actions/upload-artifact@v3
101         with:
102           name: git-cola-latest-${{github.run_number}}-${{runner.os}}
103           path: build/nsis/git-cola*.exe
105   macos:
106     name: macOS
107     runs-on: macos-latest
108     steps:
109       - name: Checkout
110         uses: actions/checkout@v3
111       - name: Install Rust
112         run: rustup toolchain install stable --profile minimal --no-self-update
113       - name: Install Garden
114         run: cargo install garden-tools
115       - uses: Swatinem/rust-cache@v2
116       - name: Install Dependencies
117         run: |
118           set -x
119           brew install git-cola
120           python3 -m venv env3
121           source env3/bin/activate
122           python -m pip install wheel
123           python -m pip install Sphinx==5.3.0
124           garden requirements
125           garden requirements/dev
126       - name: Build Bundle
127         run: |
128           set -x
129           source env3/bin/activate
130           garden macos/app
131           mv git-cola.app build/
132       - name: Zip Artifact
133         run: zip -r git-cola.app.zip build/*
134       - name: Upload Artifact
135         uses: actions/upload-artifact@v3
136         with:
137           name: git-cola-latest-${{github.run_number}}-${{runner.os}}
138           path: git-cola.app.zip