From 5c53b579333f9e8ec3ed2562b25a03c0daaac6bd Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Feb 2022 19:38:17 +0100 Subject: [PATCH] Reduce number of github workflow runs Signed-off-by: trivernis --- .github/workflows/build-api.yml | 59 ---------- .github/workflows/build-daemon.yml | 51 --------- .github/workflows/build-ui.yml | 150 ------------------------- .github/workflows/build.yml | 174 +++++++++++++++++++++++++++++ 4 files changed, 174 insertions(+), 260 deletions(-) delete mode 100644 .github/workflows/build-api.yml delete mode 100644 .github/workflows/build-daemon.yml delete mode 100644 .github/workflows/build-ui.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml deleted file mode 100644 index 0b18874..0000000 --- a/.github/workflows/build-api.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Build and test api - -on: - workflow_dispatch: - push: - branches: [ main, develop ] - pull_request: - branches: [ main, develop ] - -env: - CARGO_TERM_COLOR: always - -jobs: - - build: - - defaults: - run: - shell: bash - working-directory: mediarepo-api - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - if: ${{ !env.ACT }} - - - name: Cache build data - if: ${{ !env.ACT }} - uses: actions/cache@v2 - with: - path: | - target - ~/.cargo/ - key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Install OS-specific dependencies - uses: knicknic/os-specific-run@v1.0.3 - with: - linux: | - sudo apt-get update - DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y - - - name: Build - run: cargo build - - - name: Build API - run: cargo build --features=client-api - - - name: Build Plugin - run: cargo build --features=tauri-plugin - - - name: Test - run: cargo test --all-features \ No newline at end of file diff --git a/.github/workflows/build-daemon.yml b/.github/workflows/build-daemon.yml deleted file mode 100644 index dd5be49..0000000 --- a/.github/workflows/build-daemon.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Build daemon - -on: - workflow_dispatch: - push: - branches: [ main, develop ] - pull_request: - branches: [ main, develop ] - -env: - CARGO_TERM_COLOR: always - -jobs: - - build: - - defaults: - run: - shell: bash - working-directory: mediarepo-daemon - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - if: ${{ !env.ACT }} - - - name: Cache build data - if: ${{ !env.ACT }} - uses: actions/cache@v2 - with: - path: | - target - ~/.cargo/ - key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Build - run: cargo build --release --no-default-features - - - name: Upload artifacts - if: ${{ !env.ACT }} - uses: actions/upload-artifact@v2 - with: - name: mediarepo-daemon-${{ runner.os }} - path: | - target/release/mediarepo-daemon* \ No newline at end of file diff --git a/.github/workflows/build-ui.yml b/.github/workflows/build-ui.yml deleted file mode 100644 index 63d65ab..0000000 --- a/.github/workflows/build-ui.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: Build ui - -on: - workflow_dispatch: - push: - branches: - - main - - develop - pull_request: - branches: - - main - - develop - -jobs: - - build-debug: - defaults: - run: - shell: bash - working-directory: mediarepo-ui - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - - steps: - - uses: actions/checkout@v2 - if: ${{ !env.ACT }} - - - name: Cache Dependencies - if: ${{ !env.ACT }} - id: cache-dependencies - uses: actions/cache@v2 - with: - path: | - node_modules - src-tauri/target/**/deps - /home/runner/.cargo/bin - ~/.cargo - key: ${{ runner.os }}-dependencies-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-dependencies- - ${{ runner.os }}-release-dependencies- - - - name: Use Node.js 16 - uses: actions/setup-node@v1 - with: - node-version: 16 - - - name: Install Tauri - run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri - - - name: Install Angular CLI - run: npm install -g @angular/cli - - - name: Install yarn - run: npm install -g yarn - - - name: Install dependencies - run: yarn install - - - name: Install OS-specific dependencies - uses: knicknic/os-specific-run@v1.0.3 - with: - linux: | - sudo apt-get update - DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y - - - name: Build project - run: cargo tauri build --debug - - - name: Upload artifacts - if: ${{ !env.ACT }} - uses: actions/upload-artifact@v2 - with: - name: mediarepo-ui-${{ runner.os }}-debug - path: | - src-tauri/target/debug/bundle - src-tauri/target/debug/mediarepo-ui* - - build-release: - - defaults: - run: - shell: bash - working-directory: mediarepo-ui - - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - - steps: - - uses: actions/checkout@v2 - if: ${{ !env.ACT }} - - - name: Cache Dependencies - if: ${{ !env.ACT }} - id: cache-dependencies - uses: actions/cache@v2 - with: - path: | - node_modules - src-tauri/target - /home/runner/.cargo - ~/.cargo - key: ${{ runner.os }}-release-dependencies-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-release-dependencies- - ${{ runner.os }}-dependencies- - - - name: Use Node.js 16 - uses: actions/setup-node@v1 - with: - node-version: 16 - - - name: Install Tauri - run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri - - - name: Install Angular CLI - run: npm install -g @angular/cli - - - name: Install yarn - run: npm install -g yarn - - - name: Install dependencies - run: yarn install - - - name: Install OS-specific dependencies - uses: knicknic/os-specific-run@v1.0.3 - with: - linux: | - sudo apt-get update - DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y - - - name: Build project - run: cargo tauri build - - - name: Upload artifacts - if: ${{ !env.ACT }} - uses: actions/upload-artifact@v2 - with: - name: mediarepo-ui-${{ runner.os }}-release - path: | - src-tauri/target/release/bundle - src-tauri/target/release/mediarepo-ui* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..26f53de --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,174 @@ +name: Build and test + +on: + workflow_dispatch: + push: + branches: [ main, gh-actions ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + + build-api: + + defaults: + run: + shell: bash + working-directory: mediarepo-api + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + if: ${{ !env.ACT }} + + - name: Cache build data + if: ${{ !env.ACT }} + uses: actions/cache@v2 + with: + path: | + target + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Install OS-specific dependencies + uses: knicknic/os-specific-run@v1.0.3 + with: + linux: | + sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + + - name: Build + run: cargo build + + - name: Build API + run: cargo build --features=client-api + + - name: Build Plugin + run: cargo build --features=tauri-plugin + + - name: Test + run: cargo test --all-features + + build-daemon: + + # to run fewer steps in parallel + needs: build-api + + defaults: + run: + shell: bash + working-directory: mediarepo-daemon + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + if: ${{ !env.ACT }} + + - name: Cache build data + if: ${{ !env.ACT }} + uses: actions/cache@v2 + with: + path: | + target + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build + run: cargo build --release --no-default-features + + - name: Upload artifacts + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v2 + with: + name: mediarepo-daemon-${{ runner.os }} + path: | + target/release/mediarepo-daemon* + + build-ui: + + # to run fewer steps in parallel + needs: build-api + + defaults: + run: + shell: bash + working-directory: mediarepo-ui + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v2 + if: ${{ !env.ACT }} + + - name: Cache Dependencies + if: ${{ !env.ACT }} + id: cache-dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + src-tauri/target + /home/runner/.cargo + ~/.cargo + key: ${{ runner.os }}-release-dependencies-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-release-dependencies- + ${{ runner.os }}-dependencies- + + - name: Use Node.js 16 + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Install Tauri + run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri + + - name: Install Angular CLI + run: npm install -g @angular/cli + + - name: Install yarn + run: npm install -g yarn + + - name: Install dependencies + run: yarn install + + - name: Install OS-specific dependencies + uses: knicknic/os-specific-run@v1.0.3 + with: + linux: | + sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + + - name: Build project + run: cargo tauri build + + - name: Upload artifacts + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v2 + with: + name: mediarepo-ui-${{ runner.os }}-release + path: | + src-tauri/target/release/bundle + src-tauri/target/release/mediarepo-ui*