From 22cc0ed5927d512daa8dfd3449caae1857c6e76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= <41945903+qarmin@users.noreply.github.com> Date: Wed, 7 Oct 2020 13:17:30 +0200 Subject: [PATCH] Divide CI across multiple files (#48) --- .github/workflows/ci.yml | 188 --------------------------------- .github/workflows/linux.yml | 144 +++++++++++++++++++++++++ .github/workflows/mac.yml | 93 +++++++++++++++++ .github/workflows/quality.yml | 45 ++++++++ .github/workflows/windows.yml | 191 ++++++++++++++++++++++++++++++++++ 5 files changed, 473 insertions(+), 188 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/mac.yml create mode 100644 .github/workflows/quality.yml create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index b02ee8c..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,188 +0,0 @@ -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 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..ea09ff1 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,144 @@ +name: 🐧 Linux +on: [push] + +env: + CARGO_TERM_COLOR: always + +jobs: + linux-cli: + strategy: + matrix: + toolchain: [ stable ] + type: [ release ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - uses: actions/cache@v2 + with: + path: | + target + key: linux-cli-${{github.ref}}-${{github.sha}} + restore-keys: | + linux-cli-${{github.ref}}-${{github.sha}} + + - name: Install basic libraries + run: sudo apt-get update; sudo apt install libgtk-3-dev -y + + - name: Build CLI Debug + run: cargo build --bin czkawka_cli + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'debug'}} + + - name: Build CLI Release + run: cargo build --release --bin czkawka_cli + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'release'}} + + - name: Store Linux CLI + uses: actions/upload-artifact@v2 + with: + name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }} + path: target/release/czkawka_cli + if: ${{ matrix.type == 'release' }} + + linux-gui: + strategy: + matrix: + toolchain: [ stable ] + type: [ release ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - uses: actions/cache@v2 + with: + path: | + target + key: linux-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-3-dev -y + + - name: Build GUI Debug + run: cargo build --bin czkawka_gui + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'debug'}} + + - name: Build GUI Release + run: cargo build --release --bin czkawka_gui + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + 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' }} + + linux-gui-orbtk: + strategy: + matrix: + toolchain: [ stable ] + type: [ release ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - uses: actions/cache@v2 + with: + path: | + target + key: linux-gui-orbtk-${{github.ref}}-${{github.sha}} + restore-keys: | + linux-gui-orbtk-${{github.ref}}-${{github.sha}} + + - name: Install basic libraries + run: sudo apt-get update; sudo apt install libgtk-3-dev -y + + - name: Build GUI Orbtk Debug + run: cargo build --bin czkawka_gui_orbtk + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'debug'}} + + - name: Build GUI Orbtk Release + run: cargo build --release --bin czkawka_gui_orbtk + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'release'}} + + - name: Store Linux 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' }} diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml new file mode 100644 index 0000000..24132d5 --- /dev/null +++ b/.github/workflows/mac.yml @@ -0,0 +1,93 @@ +name: 🍎 MacOS +on: [push] + +env: + CARGO_TERM_COLOR: always + +jobs: + macos-cli: + 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 + + - uses: actions/cache@v2 + with: + path: | + target + key: mac-cli-${{github.ref}}-${{github.sha}} + restore-keys: | + mac-cli-${{github.ref}}-${{github.sha}} + + - name: Build CLI Debug + run: cargo build --bin czkawka_cli + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'debug'}} + + - name: Build CLI Release + run: cargo build --release --bin czkawka_cli + 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-orbtk: + 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 + + - uses: actions/cache@v2 + with: + path: | + target + key: macos-gui-orbtk-${{github.ref}}-${{github.sha}} + restore-keys: | + macos-gui-orbtk-${{github.ref}}-${{github.sha}} + + - name: Build GUI Orbtk Debug + run: cargo build --bin czkawka_gui_orbtk + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'debug'}} + + - name: Build GUI Orbtk Release + run: cargo build --release --bin czkawka_gui_orbtk + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'release'}} + + - name: Store MacOS 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' }} diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..096261f --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,45 @@ +name: Quality + +on: + push: + branches: [master] + pull_request: + branches: [master] + +env: + CARGO_TERM_COLOR: always + +jobs: + quality: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: | + target + key: quality-${{github.ref}}-${{github.sha}} + restore-keys: | + quality-cli-${{github.ref}}-${{github.sha}} + + - 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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..59499da --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,191 @@ +name: 🏁 Windows +on: [push] + +env: + CARGO_TERM_COLOR: always + +jobs: + windows-cli: + strategy: + matrix: + toolchain: [ stable ] + type: [ release ] + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - uses: actions/cache@v2 + with: + path: | + target + key: windows-cli-${{github.ref}}-${{github.sha}} + restore-keys: | + windows-cli-${{github.ref}}-${{github.sha}} + + - name: Build CLI Debug + run: cargo build --bin czkawka_cli + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'debug'}} + + - name: Build CLI Release + run: cargo build --release --bin czkawka_cli + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'release'}} + + - name: Store Windows CLI + uses: actions/upload-artifact@v2 + with: + name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }} + path: target/release/czkawka_cli.exe + if: ${{ matrix.type == 'release' }} + + windows-gui-orbtk: + strategy: + matrix: + toolchain: [ stable ] + type: [ release ] + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - uses: actions/cache@v2 + with: + path: | + target + key: windows-gui-orbtk-${{github.ref}}-${{github.sha}} + restore-keys: | + windows-gui-orbtk-${{github.ref}}-${{github.sha}} + + - name: Build GUI Orbtk Debug + run: cargo build --bin czkawka_gui_orbtk + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'debug'}} + + - name: Build GUI Orbtk Release + run: cargo build --release --bin czkawka_gui_orbtk + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + if: ${{ matrix.type == 'release'}} + + - name: Store Windows 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' }} + + + windows-gui: + strategy: + matrix: + toolchain: [ stable ] + type: [ release ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - uses: actions/cache@v2 + with: + path: | + target + key: windows-gui-${{github.ref}}-${{github.sha}} + restore-keys: | + windows-gui-${{github.ref}}-${{github.sha}} + + - 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 + + - name: Build GUI Debug 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 + + 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: ${{ matrix.type == 'debug'}} + + - name: Build GUI Release 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: ${{ matrix.type == 'release'}} + + - name: Store Windows GUI CrossComplile + uses: actions/upload-artifact@v2 + with: + name: czkawka_gui-Windows-${{ matrix.toolchain }} + path: gtk_app.zip + if: ${{ matrix.type == 'release' }}