1
0
Fork 0
mirror of synced 2024-05-16 10:24:05 +12:00
czkawka/.github/workflows/ci.yml
2020-10-05 22:07:21 +02:00

189 lines
6.1 KiB
YAML

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
#toolchain: [stable, nightly]
toolchain: [stable]
os: [ ubuntu-20.04, macos-latest, windows-latest ]
type: [release, debug]
runs-on: ${{ matrix.os }}
# needs: clean
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- uses: actions/cache@v2
with:
path: |
target
key: ${{ matrix.os }}-cargo-check-test-${{ matrix.toolchain }}-${{ matrix.type }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install Gtk, Mingw, unzip, zip and wget
run: sudo apt-get update; sudo apt install mingw-w64 libgtk-3-dev unzip wget zip -y
if: ${{ runner.os == 'Linux' }}
- name: Build Debug
run: cargo build --all
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os == 'Linux' && matrix.type == 'debug'}}
- name: Build Release
run: cargo build --all --release
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os == 'Linux' && matrix.type == 'release'}}
- name: Build GUI Windows Cross Compile
run: |
rustup target add x86_64-pc-windows-gnu
echo "[target.x86_64-pc-windows-gnu]" > ~/.cargo/config
echo "linker = \"x86_64-w64-mingw32-gcc\"" >> ~/.cargo/config
echo "ar = \"x86_64-w64-mingw32-gcc-ar\"" >> ~/.cargo/config
GTK_LIBRARY="$(pwd)/gtk_library"
GTK_APP="$(pwd)/gtk_app"
wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/mingw64.zip
unzip mingw64.zip -d $GTK_LIBRARY
GTK_LIBRARY="$GTK_LIBRARY/mingw64"
PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH="$GTK_LIBRARY/lib/pkgconfig" RUSTFLAGS="-L $GTK_LIBRARY/lib" cargo build --target=x86_64-pc-windows-gnu --bin czkawka_gui --release
mkdir $GTK_APP
cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe $GTK_APP
cp $GTK_LIBRARY/bin/*.dll $GTK_APP
mkdir -p $GTK_APP/share/glib-2.0/schemas
mkdir $GTK_APP/share/icons
cp $GTK_LIBRARY/share/glib-2.0/schemas/* $GTK_APP/share/glib-2.0/schemas
cp -r $GTK_LIBRARY/share/icons/* $GTK_APP/share/icons
mkdir $GTK_APP/lib
cp -r $GTK_LIBRARY/lib/gdk-pixbuf-2.0 $GTK_APP/lib
zip -r gtk_app.zip $GTK_APP
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os == 'Linux' && matrix.type == 'release'}}
- name: Build CLI Alt Debug
run: cargo build --bin czkawka_cli
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os != 'Linux' && matrix.type == 'debug'}}
- name: Build CLI Alt Release
run: cargo build --release --bin czkawka_cli
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os != 'Linux' && matrix.type == 'release'}}
- name: Build GUI Orbtk Alt Debug
run: cargo build --bin czkawka_gui_orbtk
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os != 'Linux' && matrix.type == 'debug'}}
- name: Build GUI Orbtk Alt Release
run: cargo build --release --bin czkawka_gui_orbtk
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os != 'Linux' && matrix.type == 'release'}}
- name: Run tests
run: cargo test --workspace
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ runner.os == 'Linux'}}
- name: Store Czkawka CLI
uses: actions/upload-artifact@v2
with:
name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_cli
if: ${{ matrix.type == 'release' && runner.os != 'Windows'}}
- name: Store Czkawka CLI
uses: actions/upload-artifact@v2
with:
name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_cli.exe
if: ${{ matrix.type == 'release' && runner.os == 'Windows'}}
- name: Store Czkawka GUI
uses: actions/upload-artifact@v2
with:
name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_gui
if: ${{ runner.os == 'Linux' && matrix.type == 'release'}}
- name: Store Czkawka Windows GUI CrossComplile
uses: actions/upload-artifact@v2
with:
name: czkawka_gui-Windows-GTK-GUI-${{ matrix.toolchain }}
path: gtk_app.zip
if: ${{ runner.os == 'Linux' && matrix.type == 'release'}}
- name: Store Czkawka GUI Orbtk
uses: actions/upload-artifact@v2
with:
name: czkawka_gui_orbtk-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_gui_orbtk
if: ${{ matrix.type == 'release' && runner.os != 'Windows'}}
- name: Store Czkawka GUI Orbtk
uses: actions/upload-artifact@v2
with:
name: czkawka_gui_orbtk-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_gui_orbtk.exe
if: ${{ matrix.type == 'release' && runner.os == 'Windows'}}
clean:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Install Gtk
run: sudo apt install -y libgtk-3-dev
- name: Check the format
run: cargo fmt --all -- --check
# type complexity must be ignored because we use huge templates for queries
- name: Run clippy
run: >
cargo clippy
--all-targets
--all-features
--
-D warnings