garden: get rid of unnecessary variables
[git-cola.git] / .github / workflows / ci.yml
blobc67717f7e7d062fd42fa327f4c71a3f1a8ce668f
1 name: CI
3 on: [push, pull_request]
5 jobs:
6   build:
7     name: Build
8     runs-on: ubuntu-latest
9     steps:
10       - name: Cancel Previous Runs
11         uses: styfle/cancel-workflow-action@0.12.1
12       - name: Checkout
13         uses: actions/checkout@v4
14       - name: Install Rust
15         run: rustup toolchain install stable --profile minimal --no-self-update
16       - name: Install Garden
17         run: cargo install garden-tools
18       - uses: Swatinem/rust-cache@v2
19       - name: Install build dependencies
20         run: |
21           set -x
22           sudo apt-get update
23           sudo apt-get install python3-sphinx python3-qtpy python3-pyqt5
24       - name: Install Git Cola
25         run: garden -vv -D prefix=dist install
27   test:
28     name: Test
29     runs-on: ubuntu-latest
30     steps:
31       - name: Cancel Previous Runs
32         uses: styfle/cancel-workflow-action@0.12.1
33       - name: Checkout
34         uses: actions/checkout@v4
35       - name: Install Rust
36         run: rustup toolchain install stable --profile minimal --no-self-update
37       - name: Install Garden
38         run: cargo install garden-tools
39       - uses: Swatinem/rust-cache@v2
40       - name: Install Dependencies
41         run: |
42           set -x
43           sudo apt-get update
44           # Runtime dependencies (required)
45           sudo apt-get install \
46               python3-qtpy \
47               python3-pyqt5
48           # Runtime dependencies (optional)
49           sudo apt-get install \
50               python3-send2trash
51           # Development dependencies
52           sudo apt-get install \
53               python3-pytest \
54               python3-setuptools-scm \
55               python3-sphinx
56           pip install cercis
57       - name: Configure tests
58         run: |
59           git config --global user.name "Git Cola"
60           git config --global user.email git-cola@localhost
61       - name: Run tests and checks
62         run: garden -vv check
63       - name: Code formatting
64         run: garden -vv fmt -- --check
66   windows:
67     name: Windows
68     runs-on: windows-latest
69     steps:
70       - name: Cancel Previous Runs
71         uses: styfle/cancel-workflow-action@0.12.1
72       - name: Checkout
73         uses: actions/checkout@v4
74       - name: Setup Python
75         uses: actions/setup-python@v5
76         with:
77           python-version: '3.x'
78           architecture: x64
79       - name: Pip Cache
80         uses: actions/cache@v4
81         with:
82           path: ~/AppData/Local/pip/Cache
83           key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
84       - name: Install Dependencies
85         run: |
86           pip install '.[build,docs,dev,extras]'
87       # Based on: contrib/win32/run-pynsist.sh
88       - name: Build Installer
89         run: |
90           make doc
91           make htmldir="$PWD/share/doc/git-cola/html" install-doc
92           pynsist pynsist.cfg
93           rm -r share/doc/git-cola/html
95           # Rename executable output
96           cd build/nsis
97           mv git-cola*.exe git-cola-latest-${{github.run_number}}.exe
98       - name: Upload Artifact
99         uses: actions/upload-artifact@v4
100         with:
101           name: git-cola-latest-${{github.run_number}}-${{runner.os}}
102           path: build/nsis/git-cola*.exe
104   macos:
105     name: macOS
106     runs-on: macos-latest
107     steps:
108       - name: Cancel Previous Runs
109         uses: styfle/cancel-workflow-action@0.12.1
110       - name: Checkout
111         uses: actions/checkout@v4
112       - name: Install Rust
113         run: rustup toolchain install stable --profile minimal --no-self-update
114       - name: Install Garden
115         run: cargo install garden-tools
116       - uses: Swatinem/rust-cache@v2
117       - name: Install Dependencies
118         run: |
119           brew install git-cola
120       - name: Build Bundle
121         run: |
122           garden -vv macos/app
123           mv git-cola.app build/
124       - name: Zip Artifact
125         run: zip -r git-cola.app.zip build/*
126       - name: Upload Artifact
127         uses: actions/upload-artifact@v4
128         with:
129           name: git-cola-latest-${{github.run_number}}-${{runner.os}}
130           path: git-cola.app.zip