From 50bcca32607e47caa7db85a3c86c3f36d4ce0ad8 Mon Sep 17 00:00:00 2001 From: Mikhail Zolotukhin Date: Tue, 2 Nov 2021 23:12:34 +0300 Subject: [PATCH] chore: adjust github actions workflows to 2.0 --- .github/scripts/sysdep-install.sh | 14 ++++++++ .github/scripts/utils-install.sh | 8 +++++ .github/workflows/commit-lint.yml | 3 ++ .github/workflows/docs.yml | 6 ++++ .github/workflows/master.yml | 29 +++++++++++----- .github/workflows/release-please.yml | 18 ---------- CONTRIBUTING.md | 1 + README.md | 1 + package.json | 4 +-- scripts/sysdep-install.sh | 50 ++++++++++++++++++++++++++++ 10 files changed, 106 insertions(+), 28 deletions(-) create mode 100755 .github/scripts/sysdep-install.sh create mode 100755 .github/scripts/utils-install.sh create mode 100644 scripts/sysdep-install.sh diff --git a/.github/scripts/sysdep-install.sh b/.github/scripts/sysdep-install.sh new file mode 100755 index 00000000..5f3b875f --- /dev/null +++ b/.github/scripts/sysdep-install.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +# SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin +# SPDX-License-Identifier: MIT + +set -e + +apt-get update && apt-get install -y \ + zip cmake ninja-build extra-cmake-modules kirigami2-dev \ + libkf5config-dev libkf5configwidgets-dev libkf5coreaddons-dev \ + libkf5declarative-dev libkf5i18n-dev libkf5kcmutils-dev \ + libqt5svg5-dev qml-module-qtquick* qtbase5-dev \ + qtdeclarative5-dev qtquickcontrols2-5-dev g++ + diff --git a/.github/scripts/utils-install.sh b/.github/scripts/utils-install.sh new file mode 100755 index 00000000..cf6f1255 --- /dev/null +++ b/.github/scripts/utils-install.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin +# SPDX-License-Identifier: MIT + +set -e + +apt-get update && apt-get install -y npm diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml index fe02bc82..241974ae 100644 --- a/.github/workflows/commit-lint.yml +++ b/.github/workflows/commit-lint.yml @@ -16,10 +16,13 @@ jobs: uses: actions/checkout@v2.3.1 with: fetch-depth: 0 + - name: Install Commit Linting Tool ๐Ÿ”ง run: npm install --save-dev @commitlint/{cli,config-conventional} + - name: Set Linting Config to Conventional Commits spec ๐Ÿ”ง run: | echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js + - name: Lint ๐Ÿšจ run: npx commitlint --from HEAD~1 --to HEAD --verbose diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4cab5442..0b9d7eab 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,10 +12,16 @@ on: jobs: build-and-deploy: runs-on: ubuntu-latest + container: ubuntu:21.10 + env: + DEBIAN_FRONTEND: noninteractive steps: - name: Checkout ๐Ÿ›Ž๏ธ uses: actions/checkout@v2.3.1 + - name: Setup CI Utils โš™๏ธ + run: .github/scripts/utils-install.sh + - name: Install and Build ๐Ÿ”ง run: | npm install diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 06357c87..3fe72e7a 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,10 +16,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Code + - name: Checkout Code ๐Ÿ›Ž๏ธ uses: actions/checkout@v2 - - name: REUSE Compliance Check + - name: REUSE Compliance Check ๐Ÿ›๏ธ uses: fsfe/reuse-action@v1 lint: @@ -27,22 +27,22 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Code + - name: Checkout Code ๐Ÿ›Ž๏ธ uses: actions/checkout@v2 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - - name: Validate QML and JavaScript files + - name: Validate QML and JavaScript files ๐Ÿ’š uses: liri-infra/qmllint-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Dev Dependencies for Linters + - name: Install Dev Dependencies for Linters โš™๏ธ run: | npm install - - name: Lint via Super Linter + - name: Lint via Super Linter ๐Ÿšจ uses: github/super-linter@v4 env: VALIDATE_ALL_CODEBASE: false @@ -57,24 +57,37 @@ jobs: build: name: Build + container: ubuntu:21.10 + env: + DEBIAN_FRONTEND: noninteractive runs-on: ubuntu-latest steps: - - name: Checkout Code + - name: Checkout Code ๐Ÿ›Ž๏ธ uses: actions/checkout@v2 + - name: Setup CI Utils โš™๏ธ + run: .github/scripts/utils-install.sh + - name: Build ๐Ÿ”ง run: | npm install + .github/scripts/sysdep-install.sh npm run build test: name: Unit Tests + container: ubuntu:21.10 + env: + DEBIAN_FRONTEND: noninteractive runs-on: ubuntu-latest steps: - - name: Checkout Code + - name: Checkout Code ๐Ÿ›Ž๏ธ uses: actions/checkout@v2 + - name: Setup CI Utils โš™๏ธ + run: .github/scripts/utils-install.sh + - name: Test ๐Ÿงช run: | npm install diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 4a12abe1..d4ff2b22 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -20,21 +20,3 @@ jobs: with: release-type: node package-name: release-please-action - - - uses: actions/checkout@v2 - if: ${{ steps.release.outputs.release_created }} - - - name: Package ๐Ÿ“ฆ - run: | - npm install - npm run package - if: ${{ steps.release.outputs.release_created }} - - - name: Publish ๐ŸŽ‰ - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ steps.release.outputs.tag_name }} - files: | - build/package/bismuth.tar.gz - build/package/bismuth.kwinscript - if: ${{ steps.release.outputs.release_created }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f7e9fe6..abffbc14 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,7 @@ To prepare environment, clone the project and execute the following: ```sh npm install # Install development dependencies +npm run sysdep-install # Install system dependencies ``` This will install all the things you need, including TypeScript compiler, Unit diff --git a/README.md b/README.md index b98ef076..4fcfc59f 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ script. Install script from source: npm install # Installs dependencies for building + npm run sysdep-install # Install system dependencies for building npm run bi-install # Installs all Bismuth components To uninstall: diff --git a/package.json b/package.json index 88552140..04cee98c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "scripts": { "clean": "scripts/clean.sh", "build": "scripts/build.sh", + "sysdep-install": "scripts/sysdep-install.sh", "prebi-install": "npm run build", "bi-install": "scripts/install.sh", "bi-uninstall": "scripts/uninstall.sh", @@ -36,8 +37,7 @@ "postinstall-and-restart-kwin-x11": "bash -ic \"kwin_x11 --replace & disown\"", "docs": "npx typedoc --out $npm_package_config_build_dir/docs", "test": "jest", - "prepare": "husky install", - "postinstall": "scripts/dep-install.sh" + "prepare": "husky install" }, "repository": { "type": "git", diff --git a/scripts/sysdep-install.sh b/scripts/sysdep-install.sh new file mode 100644 index 00000000..67f63f5f --- /dev/null +++ b/scripts/sysdep-install.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env sh + +# SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin +# SPDX-License-Identifier: MIT + +set -e + +echo "โ›“๏ธ Installing system dependencies..." + +if [ -f /etc/os-release ]; then + . /etc/os-release + + case $ID in + + "ubuntu" | "pop" | "debian") + sudo apt-get install -y \ + zip cmake ninja-build extra-cmake-modules kirigami2-dev \ + libkf5config-dev libkf5configwidgets-dev libkf5coreaddons-dev \ + libkf5declarative-dev libkf5i18n-dev libkf5kcmutils-dev \ + libqt5svg5-dev qml-module-qtquick* qtbase5-dev \ + qtdeclarative5-dev qtquickcontrols2-5-dev g++ + ;; + + "fedora") + sudo dnf install -y \ + kf5-kconfigwidgets-devel qt5-qtbase-devel qt5-qtbase-private-devel \ + qt5-qtdeclarative-devel qt5-qtquickcontrols2-devel qt5-qtsvg-devel \ + qt5-qtfeedback-devel cmake ninja-build extra-cmake-modules \ + kf5-kcmutils-devel kf5-ki18n-devel kf5-kdeclarative-devel + ;; + + "opensuse-tumbleweed" | "opensuse-leap") + sudo zypper --non-interactive install --recommends -t pattern devel_qt5 devel_C_C++ + sudo zypper --non-interactive in -y \ + ninja extra-cmake-modules kconfig-devel kcmutils-devel kdeclarative-devel \ + ki18n-devel + ;; + + "arch") + sudo pacman -S --noconfirm --needed \ + cmake ninja extra-cmake-modules + ;; + + *) + echo "โš  Your distribution is $PRETTY_NAME, but you have to install system dependencies manually." + ;; + esac +else + echo "โš  Cannot detect your distribution. You have to install system dependencies manually." +fi