From 67db713a059b8b5b066ccf37bf82b7846c3b54ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= <41945903+qarmin@users.noreply.github.com> Date: Fri, 29 Jul 2022 19:26:28 +0200 Subject: [PATCH] Add tests to CI (#791) * Add tests to CI * Xvfb * Smaller amount of workflows * ABCD --- .github/workflows/linux.yml | 114 ++++++++++++++++-------------------- .github/workflows/mac.yml | 45 ++++---------- 2 files changed, 62 insertions(+), 97 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3e5c17f..12d4f15 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -9,10 +9,10 @@ env: CARGO_TERM_COLOR: always jobs: - linux-cli: + linux-default: strategy: matrix: - toolchain: [ stable ] + toolchain: [ stable, 1.60.0 ] type: [ release ] runs-on: ubuntu-22.04 steps: @@ -27,19 +27,26 @@ jobs: with: path: | target - key: linux-cli-${{github.ref}}-${{github.sha}} + key: linux-default-${{github.ref}}-${{github.sha}} restore-keys: | - linux-cli-${{github.ref}}-${{github.sha}} + linux-default-${{github.ref}}-${{github.sha}} - name: Install basic libraries run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev -y - - name: Build CLI Release - run: cargo build --release --bin czkawka_cli --features heif + - name: Build Release + run: cargo build --release + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0" + if: ${{ (matrix.type == 'release') && (matrix.toolchain == '1.60.0') }} + + - name: Build Release Heif + run: cargo build --release --features heif env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0" - if: ${{ matrix.type == 'release'}} + if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }} - name: Store Linux CLI uses: actions/upload-artifact@v2 @@ -48,6 +55,13 @@ jobs: path: target/release/czkawka_cli if: ${{ matrix.type == 'release' }} + - name: Store Linux GUI + uses: actions/upload-artifact@v2 + with: + name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }} + path: target/release/czkawka_gui + if: ${{ matrix.type == 'release' }} + # Duplicate finder checks included and excluded directories # Others are just check delete files number - name: Linux Regression Test @@ -118,12 +132,11 @@ jobs: python3 misc/check_results.py TestSuite 15 8 target/release/czkawka_cli temp -d "$(pwd)/TestSuite" -D python3 misc/check_results.py TestSuite 14 8 - if: ${{ matrix.type == 'release' }} - linux-gui: + linux-appimage-gui: strategy: matrix: - toolchain: [ stable, 1.60.0 ] + toolchain: [ stable ] type: [ release ] runs-on: ubuntu-22.04 steps: @@ -138,38 +151,36 @@ jobs: with: path: | target - key: linux-gui-${{github.ref}}-${{github.sha}} + key: linux-appimage-gui-${{github.ref}}-${{github.sha}} restore-keys: | - linux-gui-${{github.ref}}-${{github.sha}} - - - name: Install Gtk, Mingw, unzip, zip and wget - run: sudo apt-get update; sudo apt install libgtk-4-dev fuse libfuse2 - if: ${{ matrix.toolchain == '1.60.0' }} + linux-appimage-gui-${{github.ref}}-${{github.sha}} - - name: Install Gtk, Mingw, unzip, zip and wget and libheif - run: sudo apt-get update; sudo apt install libgtk-4-dev fuse libfuse2 libheif-dev -y - if: ${{ matrix.toolchain == 'stable' }} + - name: Install Dependencies + run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y - - name: Build GUI Release - run: cargo build --release --bin czkawka_gui + - name: Build Release + run: cargo build --release env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0" - if: ${{ (matrix.type == 'release') && (matrix.toolchain == '1.60.0') }} - - name: Build GUI Release - run: cargo build --release --bin czkawka_gui --features heif - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" - if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }} + - name: Download appimage dependiences + run: | + pwd + wget -c "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh" + wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" + chmod +x linuxdeploy-plugin-gtk.sh + chmod +x linuxdeploy-x86_64.AppImage + mkdir -p AppDir/usr/bin + pwd + cp target/release/czkawka_gui AppDir/usr/bin + ./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 - - name: Store Linux GUI + - name: Store Linux Appimage GUI uses: actions/upload-artifact@v2 with: - name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }} - path: target/release/czkawka_gui - if: ${{ matrix.type == 'release' }} + name: czkawka_gui-appimage-${{ runner.os }}-${{ matrix.toolchain }} + path: Czkawka*.AppImage - name: Minimal AppImage run: | @@ -188,12 +199,11 @@ jobs: name: czkawka_gui-${{ matrix.toolchain }}_minimal_AppImage path: out/*.AppImage - - linux-appimage-gui: + linux-tests: strategy: matrix: toolchain: [ stable ] - type: [ release ] + type: [ debug ] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 @@ -203,35 +213,11 @@ jobs: toolchain: ${{ matrix.toolchain }} override: true - - uses: actions/cache@v2 - with: - path: | - target - key: linux-appimage-gui-${{github.ref}}-${{github.sha}} - restore-keys: | - linux-appimage-gui-${{github.ref}}-${{github.sha}} + - name: Install Dependencies + run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y xvfb - - name: Install Gtk, - run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y - - - name: Build GUI Release - run: cargo build --release --bin czkawka_gui + - name: Test + run: xvfb-run cargo test env: CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" - - - name: Download appimage dependiences - run: | - wget -c "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh" - wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" - chmod +x linuxdeploy-plugin-gtk.sh - chmod +x linuxdeploy-x86_64.AppImage - mkdir -p AppDir/usr/bin - cp target/release/czkawka_gui AppDir/usr/bin - ./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 - - - name: Store Linux Appimage GUI - uses: actions/upload-artifact@v2 - with: - name: czkawka_gui-appimage-${{ runner.os }}-${{ matrix.toolchain }} - path: Czkawka*.AppImage + RUSTFLAGS: "-C debuginfo=0" \ No newline at end of file diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index e188529..a4632cb 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -27,37 +27,9 @@ jobs: with: path: | target - key: mac-cli-${{github.ref}}-${{github.sha}} + key: mac-${{github.ref}}-${{github.sha}} restore-keys: | - mac-cli-${{github.ref}}-${{github.sha}} - - - name: Build CLI Release - run: cargo build --release --bin czkawka_cli --features heif - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0 -D warnings" - if: ${{ matrix.type == 'release'}} - - - name: Store MacOS CLI - uses: actions/upload-artifact@v2 - with: - name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }} - path: target/release/czkawka_cli - if: ${{ matrix.type == 'release' }} - - macos-gui: - strategy: - matrix: - toolchain: [ stable ] - type: [ release ] - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true + mac-${{github.ref}}-${{github.sha}} - name: Install Homebrew run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" @@ -68,16 +40,23 @@ jobs: - name: Install GTK4 run: brew install rust gtk4 libheif - - name: Build GUI Release - run: cargo build --release --bin czkawka_gui --features heif + - name: Build Release + run: cargo build --release --features heif env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0 -D warnings" if: ${{ matrix.type == 'release'}} + - name: Store MacOS CLI + uses: actions/upload-artifact@v2 + with: + name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }} + path: target/release/czkawka_cli + if: ${{ matrix.type == 'release' }} + - name: Store MacOS GUI uses: actions/upload-artifact@v2 with: name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }} path: target/release/czkawka_gui - if: ${{ matrix.type == 'release' }} + if: ${{ matrix.type == 'release' }} \ No newline at end of file