From db5a7f08209df36e03c74ab07a864bc63ce11482 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 19:41:28 +0100 Subject: [PATCH 01/10] Add correct working directory to jobs default Signed-off-by: trivernis --- .github/workflows/build-api.yml | 16 ++++++++++------ .github/workflows/build-daemon.yml | 11 ++++++++--- .github/workflows/build-ui.yml | 26 ++++++++++++++++---------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index 6a9eee2..65796aa 100644 --- a/.github/workflows/build-api.yml +++ b/.github/workflows/build-api.yml @@ -10,7 +10,12 @@ env: CARGO_TERM_COLOR: always jobs: - + + defaults: + run: + shell: bash + working-directory: mediarepo-api + build: strategy: fail-fast: false @@ -19,11 +24,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - - name: switch working directory - run: cd mediarepo-api + if: ${{ !env.ACT }} - name: Cache build data + if: ${{ !env.ACT }} uses: actions/cache@v2 with: path: | @@ -37,8 +41,8 @@ jobs: uses: knicknic/os-specific-run@v1.0.3 with: linux: | - sudo apt update - sudo apt install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y - name: Build run: cargo build diff --git a/.github/workflows/build-daemon.yml b/.github/workflows/build-daemon.yml index 7960db3..1ec7d94 100644 --- a/.github/workflows/build-daemon.yml +++ b/.github/workflows/build-daemon.yml @@ -10,6 +10,11 @@ env: CARGO_TERM_COLOR: always jobs: + + defaults: + run: + shell: bash + working-directory: mediarepo-daemon build: strategy: @@ -19,11 +24,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - - name: switch working directory - run: cd mediarepo-daemon + if: ${{ !env.ACT }} - name: Cache build data + if: ${{ !env.ACT }} uses: actions/cache@v2 with: path: | @@ -37,6 +41,7 @@ jobs: run: cargo build --release --no-default-features - name: Upload artifacts + if: ${{ !env.ACT }} uses: actions/upload-artifact@v2 with: name: mediarepo-daemon-${{ runner.os }} diff --git a/.github/workflows/build-ui.yml b/.github/workflows/build-ui.yml index a5841bb..a39974d 100644 --- a/.github/workflows/build-ui.yml +++ b/.github/workflows/build-ui.yml @@ -8,6 +8,12 @@ on: - github-actions jobs: + + defaults: + run: + shell: bash + working-directory: mediarepo-ui + build-debug: runs-on: ${{ matrix.os }} @@ -19,11 +25,10 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: switch working directory - run: cd mediarepo-ui + if: ${{ !env.ACT }} - name: Cache Dependencies + if: ${{ !env.ACT }} id: cache-dependencies uses: actions/cache@v2 with: @@ -58,13 +63,14 @@ jobs: uses: knicknic/os-specific-run@v1.0.3 with: linux: | - sudo apt update - sudo apt install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + apt-get update + DEBIAN_FRONTEND=noninteractive 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 @@ -83,11 +89,10 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: switch working directory - run: cd mediarepo-ui + if: ${{ !env.ACT }} - name: Cache Dependencies + if: ${{ !env.ACT }} id: cache-dependencies uses: actions/cache@v2 with: @@ -122,13 +127,14 @@ jobs: uses: knicknic/os-specific-run@v1.0.3 with: linux: | - sudo apt update - sudo apt install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + apt-get update + DEBIAN_FRONTEND=noninteractive 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 From 8bf4b82051cddd8b285b4a9ba21e3ca101620ea5 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 19:43:40 +0100 Subject: [PATCH 02/10] Fix workflow config for defaults Signed-off-by: trivernis --- .github/workflows/build-api.yml | 11 ++++++----- .github/workflows/build-daemon.yml | 11 ++++++----- .github/workflows/build-ui.yml | 15 +++++++++------ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index 65796aa..2056096 100644 --- a/.github/workflows/build-api.yml +++ b/.github/workflows/build-api.yml @@ -11,12 +11,13 @@ env: jobs: - defaults: - run: - shell: bash - working-directory: mediarepo-api - build: + + defaults: + run: + shell: bash + working-directory: mediarepo-api + strategy: fail-fast: false matrix: diff --git a/.github/workflows/build-daemon.yml b/.github/workflows/build-daemon.yml index 1ec7d94..a464350 100644 --- a/.github/workflows/build-daemon.yml +++ b/.github/workflows/build-daemon.yml @@ -10,13 +10,14 @@ env: CARGO_TERM_COLOR: always jobs: - - defaults: - run: - shell: bash - working-directory: mediarepo-daemon build: + + defaults: + run: + shell: bash + working-directory: mediarepo-daemon + strategy: fail-fast: false matrix: diff --git a/.github/workflows/build-ui.yml b/.github/workflows/build-ui.yml index a39974d..11ee8a0 100644 --- a/.github/workflows/build-ui.yml +++ b/.github/workflows/build-ui.yml @@ -9,13 +9,11 @@ on: jobs: - defaults: - run: - shell: bash - working-directory: mediarepo-ui - build-debug: - + defaults: + run: + shell: bash + working-directory: mediarepo-ui runs-on: ${{ matrix.os }} strategy: @@ -80,6 +78,11 @@ jobs: build-release: + defaults: + run: + shell: bash + working-directory: mediarepo-ui + runs-on: ${{ matrix.os }} strategy: From a7fa93466c57224d2d486caf14445afca4346810 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 19:45:13 +0100 Subject: [PATCH 03/10] Add missing workflow triggers for gh-actions branch Signed-off-by: trivernis --- .github/workflows/build-api.yml | 2 +- .github/workflows/build-daemon.yml | 2 +- .github/workflows/build-ui.yml | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index 2056096..e406bcf 100644 --- a/.github/workflows/build-api.yml +++ b/.github/workflows/build-api.yml @@ -2,7 +2,7 @@ name: Build and test api on: push: - branches: [ main, develop ] + branches: [ main, develop, gh-actions ] pull_request: branches: [ main, develop ] diff --git a/.github/workflows/build-daemon.yml b/.github/workflows/build-daemon.yml index a464350..7b2884a 100644 --- a/.github/workflows/build-daemon.yml +++ b/.github/workflows/build-daemon.yml @@ -2,7 +2,7 @@ name: Build daemon on: push: - branches: [ main, develop ] + branches: [ main, develop, gh-actions ] pull_request: branches: [ main, develop ] diff --git a/.github/workflows/build-ui.yml b/.github/workflows/build-ui.yml index 11ee8a0..8a3c0bd 100644 --- a/.github/workflows/build-ui.yml +++ b/.github/workflows/build-ui.yml @@ -5,7 +5,12 @@ on: push: branches: - main - - github-actions + - develop + - gh-actions + pull_request: + branches: + - main + - develop jobs: From 59b7196158aa3689a07227389ddcea3eed442182 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 19:47:58 +0100 Subject: [PATCH 04/10] Change dependency installation to run as superuser Signed-off-by: trivernis --- .github/workflows/build-api.yml | 4 ++-- .github/workflows/build-ui.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index e406bcf..1fd079d 100644 --- a/.github/workflows/build-api.yml +++ b/.github/workflows/build-api.yml @@ -42,8 +42,8 @@ jobs: uses: knicknic/os-specific-run@v1.0.3 with: linux: | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + 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 diff --git a/.github/workflows/build-ui.yml b/.github/workflows/build-ui.yml index 8a3c0bd..55148d1 100644 --- a/.github/workflows/build-ui.yml +++ b/.github/workflows/build-ui.yml @@ -66,8 +66,8 @@ jobs: uses: knicknic/os-specific-run@v1.0.3 with: linux: | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + 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 @@ -135,8 +135,8 @@ jobs: uses: knicknic/os-specific-run@v1.0.3 with: linux: | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + 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 From 4ce961eed47a44d128e512a43308871bea7632c4 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 20:00:51 +0100 Subject: [PATCH 05/10] Add check task Signed-off-by: trivernis --- .github/workflows/check.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..d314285 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,46 @@ +name: Run checks on all projects + +on: + push: + branches: [ main, develop, gh-actions ] + pull_request: + branches: [ main, develop ] + +env: + CARGO_TERM_COLOR: always + +jobs: + + build: + + 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: Check api + working-directory: mediarepo-api + run: cargo check + + - name: Check daemon + working-directory: mediarepo-daemon + run: cargo check + + - name: Check ui backend + working-directory: mediarepo-ui/src-tauri + run: cargo check + + - name: Install UI dependencies + working-directory: mediarepo-ui + run: | + npm i -g yarn + npm i -g @angular/cli + yarn install + + - name: Lint ui frontend + working-directory: mediarepo-ui + run: yarn lint \ No newline at end of file From 79fe7e6c520157114ced18595ae6214657878661 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 20:11:39 +0100 Subject: [PATCH 06/10] Add missing dependencies for check task Signed-off-by: trivernis --- .github/workflows/check.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index d314285..3425172 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,13 +22,20 @@ jobs: - uses: actions/checkout@v2 if: ${{ !env.ACT }} + - 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: Check api working-directory: mediarepo-api - run: cargo check + run: cargo check --all-features - name: Check daemon working-directory: mediarepo-daemon - run: cargo check + run: cargo check --no-default-features - name: Check ui backend working-directory: mediarepo-ui/src-tauri From b64056bf3cb348cb244a94571b24a88a747c668e Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 20:26:13 +0100 Subject: [PATCH 07/10] Add action to create pre-releases Signed-off-by: trivernis --- .github/workflows/release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..769769d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Create pre-release + +on: + push: + branches: + - "master" + jobs: + pre-release: + name: Pre Release + runs-on: ubuntu-latest + steps: + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: latest + prerelease: true + title: Latest Pre-Release + files: | + LICENSE \ No newline at end of file From 4ed73bcb81afe657e4361dcce1a7acba239315e6 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 20:27:29 +0100 Subject: [PATCH 08/10] Fix pre-release workflow syntax Signed-off-by: trivernis --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 769769d..d7657c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,12 +4,12 @@ on: push: branches: - "master" - jobs: - pre-release: - name: Pre Release - runs-on: ubuntu-latest +jobs: + pre-release: + name: Pre Release + runs-on: ubuntu-latest steps: - - uses: "marvinpinto/action-automatic-releases@latest" + - uses: marvinpinto/action-automatic-releases@latest with: repo_token: ${{ secrets.GITHUB_TOKEN }} automatic_release_tag: latest From d0809ef1a4dfdf19ca24f06b96b22beed964474d Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 20:32:46 +0100 Subject: [PATCH 09/10] Remove check task for ui backend because tauri is stupid Signed-off-by: trivernis --- .github/workflows/check.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3425172..d1d2044 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -37,10 +37,6 @@ jobs: working-directory: mediarepo-daemon run: cargo check --no-default-features - - name: Check ui backend - working-directory: mediarepo-ui/src-tauri - run: cargo check - - name: Install UI dependencies working-directory: mediarepo-ui run: | From 9f6d88de98f39285b8a2b02e964598f44b648e21 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 16 Jan 2022 20:34:44 +0100 Subject: [PATCH 10/10] Remove gh-actions branch from task triggers and add dispatch instead Signed-off-by: trivernis --- .github/workflows/build-api.yml | 3 ++- .github/workflows/build-daemon.yml | 3 ++- .github/workflows/build-ui.yml | 1 - .github/workflows/check.yml | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index 1fd079d..0b18874 100644 --- a/.github/workflows/build-api.yml +++ b/.github/workflows/build-api.yml @@ -1,8 +1,9 @@ name: Build and test api on: + workflow_dispatch: push: - branches: [ main, develop, gh-actions ] + branches: [ main, develop ] pull_request: branches: [ main, develop ] diff --git a/.github/workflows/build-daemon.yml b/.github/workflows/build-daemon.yml index 7b2884a..dd5be49 100644 --- a/.github/workflows/build-daemon.yml +++ b/.github/workflows/build-daemon.yml @@ -1,8 +1,9 @@ name: Build daemon on: + workflow_dispatch: push: - branches: [ main, develop, gh-actions ] + branches: [ main, develop ] pull_request: branches: [ main, develop ] diff --git a/.github/workflows/build-ui.yml b/.github/workflows/build-ui.yml index 55148d1..63d65ab 100644 --- a/.github/workflows/build-ui.yml +++ b/.github/workflows/build-ui.yml @@ -6,7 +6,6 @@ on: branches: - main - develop - - gh-actions pull_request: branches: - main diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index d1d2044..84413b0 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,8 +1,9 @@ name: Run checks on all projects on: + workflow_dispatch: push: - branches: [ main, develop, gh-actions ] + branches: [ main, develop ] pull_request: branches: [ main, develop ]