Skip to content

Commit 67db713

Browse files
authored
Add tests to CI (#791)
* Add tests to CI * Xvfb * Smaller amount of workflows * ABCD
1 parent 97563a7 commit 67db713

File tree

2 files changed

+62
-97
lines changed

2 files changed

+62
-97
lines changed

.github/workflows/linux.yml

+50-64
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ env:
99
CARGO_TERM_COLOR: always
1010

1111
jobs:
12-
linux-cli:
12+
linux-default:
1313
strategy:
1414
matrix:
15-
toolchain: [ stable ]
15+
toolchain: [ stable, 1.60.0 ]
1616
type: [ release ]
1717
runs-on: ubuntu-22.04
1818
steps:
@@ -27,19 +27,26 @@ jobs:
2727
with:
2828
path: |
2929
target
30-
key: linux-cli-${{github.ref}}-${{github.sha}}
30+
key: linux-default-${{github.ref}}-${{github.sha}}
3131
restore-keys: |
32-
linux-cli-${{github.ref}}-${{github.sha}}
32+
linux-default-${{github.ref}}-${{github.sha}}
3333
3434
- name: Install basic libraries
3535
run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev -y
3636

37-
- name: Build CLI Release
38-
run: cargo build --release --bin czkawka_cli --features heif
37+
- name: Build Release
38+
run: cargo build --release
39+
env:
40+
CARGO_INCREMENTAL: 0
41+
RUSTFLAGS: "-C debuginfo=0"
42+
if: ${{ (matrix.type == 'release') && (matrix.toolchain == '1.60.0') }}
43+
44+
- name: Build Release Heif
45+
run: cargo build --release --features heif
3946
env:
4047
CARGO_INCREMENTAL: 0
4148
RUSTFLAGS: "-C debuginfo=0"
42-
if: ${{ matrix.type == 'release'}}
49+
if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }}
4350

4451
- name: Store Linux CLI
4552
uses: actions/upload-artifact@v2
@@ -48,6 +55,13 @@ jobs:
4855
path: target/release/czkawka_cli
4956
if: ${{ matrix.type == 'release' }}
5057

58+
- name: Store Linux GUI
59+
uses: actions/upload-artifact@v2
60+
with:
61+
name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}
62+
path: target/release/czkawka_gui
63+
if: ${{ matrix.type == 'release' }}
64+
5165
# Duplicate finder checks included and excluded directories
5266
# Others are just check delete files number
5367
- name: Linux Regression Test
@@ -118,12 +132,11 @@ jobs:
118132
python3 misc/check_results.py TestSuite 15 8
119133
target/release/czkawka_cli temp -d "$(pwd)/TestSuite" -D
120134
python3 misc/check_results.py TestSuite 14 8
121-
if: ${{ matrix.type == 'release' }}
122135
123-
linux-gui:
136+
linux-appimage-gui:
124137
strategy:
125138
matrix:
126-
toolchain: [ stable, 1.60.0 ]
139+
toolchain: [ stable ]
127140
type: [ release ]
128141
runs-on: ubuntu-22.04
129142
steps:
@@ -138,38 +151,36 @@ jobs:
138151
with:
139152
path: |
140153
target
141-
key: linux-gui-${{github.ref}}-${{github.sha}}
154+
key: linux-appimage-gui-${{github.ref}}-${{github.sha}}
142155
restore-keys: |
143-
linux-gui-${{github.ref}}-${{github.sha}}
144-
145-
- name: Install Gtk, Mingw, unzip, zip and wget
146-
run: sudo apt-get update; sudo apt install libgtk-4-dev fuse libfuse2
147-
if: ${{ matrix.toolchain == '1.60.0' }}
156+
linux-appimage-gui-${{github.ref}}-${{github.sha}}
148157
149-
- name: Install Gtk, Mingw, unzip, zip and wget and libheif
150-
run: sudo apt-get update; sudo apt install libgtk-4-dev fuse libfuse2 libheif-dev -y
151-
if: ${{ matrix.toolchain == 'stable' }}
158+
- name: Install Dependencies
159+
run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y
152160

153-
- name: Build GUI Release
154-
run: cargo build --release --bin czkawka_gui
161+
- name: Build Release
162+
run: cargo build --release
155163
env:
156164
CARGO_INCREMENTAL: 0
157165
RUSTFLAGS: "-C debuginfo=0"
158-
if: ${{ (matrix.type == 'release') && (matrix.toolchain == '1.60.0') }}
159166

160-
- name: Build GUI Release
161-
run: cargo build --release --bin czkawka_gui --features heif
162-
env:
163-
CARGO_INCREMENTAL: 0
164-
RUSTFLAGS: "-C debuginfo=0"
165-
if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }}
167+
- name: Download appimage dependiences
168+
run: |
169+
pwd
170+
wget -c "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"
171+
wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
172+
chmod +x linuxdeploy-plugin-gtk.sh
173+
chmod +x linuxdeploy-x86_64.AppImage
174+
mkdir -p AppDir/usr/bin
175+
pwd
176+
cp target/release/czkawka_gui AppDir/usr/bin
177+
./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin gtk --output appimage --icon-file data/icons/com.github.qarmin.czkawka.svg --desktop-file data/com.github.qarmin.czkawka.desktop
166178
167-
- name: Store Linux GUI
179+
- name: Store Linux Appimage GUI
168180
uses: actions/upload-artifact@v2
169181
with:
170-
name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}
171-
path: target/release/czkawka_gui
172-
if: ${{ matrix.type == 'release' }}
182+
name: czkawka_gui-appimage-${{ runner.os }}-${{ matrix.toolchain }}
183+
path: Czkawka*.AppImage
173184

174185
- name: Minimal AppImage
175186
run: |
@@ -188,12 +199,11 @@ jobs:
188199
name: czkawka_gui-${{ matrix.toolchain }}_minimal_AppImage
189200
path: out/*.AppImage
190201

191-
192-
linux-appimage-gui:
202+
linux-tests:
193203
strategy:
194204
matrix:
195205
toolchain: [ stable ]
196-
type: [ release ]
206+
type: [ debug ]
197207
runs-on: ubuntu-22.04
198208
steps:
199209
- uses: actions/checkout@v2
@@ -203,35 +213,11 @@ jobs:
203213
toolchain: ${{ matrix.toolchain }}
204214
override: true
205215

206-
- uses: actions/cache@v2
207-
with:
208-
path: |
209-
target
210-
key: linux-appimage-gui-${{github.ref}}-${{github.sha}}
211-
restore-keys: |
212-
linux-appimage-gui-${{github.ref}}-${{github.sha}}
216+
- name: Install Dependencies
217+
run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y xvfb
213218

214-
- name: Install Gtk,
215-
run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y
216-
217-
- name: Build GUI Release
218-
run: cargo build --release --bin czkawka_gui
219+
- name: Test
220+
run: xvfb-run cargo test
219221
env:
220222
CARGO_INCREMENTAL: 0
221-
RUSTFLAGS: "-C debuginfo=0"
222-
223-
- name: Download appimage dependiences
224-
run: |
225-
wget -c "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"
226-
wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
227-
chmod +x linuxdeploy-plugin-gtk.sh
228-
chmod +x linuxdeploy-x86_64.AppImage
229-
mkdir -p AppDir/usr/bin
230-
cp target/release/czkawka_gui AppDir/usr/bin
231-
./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin gtk --output appimage --icon-file data/icons/com.github.qarmin.czkawka.svg --desktop-file data/com.github.qarmin.czkawka.desktop
232-
233-
- name: Store Linux Appimage GUI
234-
uses: actions/upload-artifact@v2
235-
with:
236-
name: czkawka_gui-appimage-${{ runner.os }}-${{ matrix.toolchain }}
237-
path: Czkawka*.AppImage
223+
RUSTFLAGS: "-C debuginfo=0"

.github/workflows/mac.yml

+12-33
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,9 @@ jobs:
2727
with:
2828
path: |
2929
target
30-
key: mac-cli-${{github.ref}}-${{github.sha}}
30+
key: mac-${{github.ref}}-${{github.sha}}
3131
restore-keys: |
32-
mac-cli-${{github.ref}}-${{github.sha}}
33-
34-
- name: Build CLI Release
35-
run: cargo build --release --bin czkawka_cli --features heif
36-
env:
37-
CARGO_INCREMENTAL: 0
38-
RUSTFLAGS: "-C debuginfo=0 -D warnings"
39-
if: ${{ matrix.type == 'release'}}
40-
41-
- name: Store MacOS CLI
42-
uses: actions/upload-artifact@v2
43-
with:
44-
name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }}
45-
path: target/release/czkawka_cli
46-
if: ${{ matrix.type == 'release' }}
47-
48-
macos-gui:
49-
strategy:
50-
matrix:
51-
toolchain: [ stable ]
52-
type: [ release ]
53-
runs-on: macos-latest
54-
steps:
55-
- uses: actions/checkout@v2
56-
57-
- uses: actions-rs/toolchain@v1
58-
with:
59-
toolchain: ${{ matrix.toolchain }}
60-
override: true
32+
mac-${{github.ref}}-${{github.sha}}
6133
6234
- name: Install Homebrew
6335
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@@ -68,16 +40,23 @@ jobs:
6840
- name: Install GTK4
6941
run: brew install rust gtk4 libheif
7042

71-
- name: Build GUI Release
72-
run: cargo build --release --bin czkawka_gui --features heif
43+
- name: Build Release
44+
run: cargo build --release --features heif
7345
env:
7446
CARGO_INCREMENTAL: 0
7547
RUSTFLAGS: "-C debuginfo=0 -D warnings"
7648
if: ${{ matrix.type == 'release'}}
7749

50+
- name: Store MacOS CLI
51+
uses: actions/upload-artifact@v2
52+
with:
53+
name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }}
54+
path: target/release/czkawka_cli
55+
if: ${{ matrix.type == 'release' }}
56+
7857
- name: Store MacOS GUI
7958
uses: actions/upload-artifact@v2
8059
with:
8160
name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}
8261
path: target/release/czkawka_gui
83-
if: ${{ matrix.type == 'release' }}
62+
if: ${{ matrix.type == 'release' }}

0 commit comments

Comments
 (0)