diff --git a/.github/workflows/ci-rust.yml b/.github/workflows/ci-rust.yml new file mode 100644 index 0000000000..302df173b0 --- /dev/null +++ b/.github/workflows/ci-rust.yml @@ -0,0 +1,106 @@ +name: CI - Rust + +on: + push: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used below for the pull request event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-rust.yml + # any change in the rust subfolder + - rust/** + # except Markdown documentation + - "!rust/**.md" + # except the packaging + - "!rust/package/**" + # except the DBus configuration + - "!rust/share/**" + + pull_request: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used above for the push event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-rust.yml + # any change in the rust subfolder + - rust/** + # except Markdown documentation + - "!rust/**.md" + # except the packaging + - "!rust/package/**" + # except the DBus configuration + - "!rust/share/**" + + # allow running manually + workflow_dispatch: + +jobs: + rust_ci: + runs-on: ubuntu-latest + env: + COVERAGE: 1 + + defaults: + run: + working-directory: ./rust + + strategy: + fail-fast: false + matrix: + distro: [ "tumbleweed" ] + + container: + image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby + options: --security-opt seccomp=unconfined + + steps: + + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Configure and refresh repositories + # disable unused repositories to have faster refresh + run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref ) + + - name: Install Rust development files + run: zypper --non-interactive install rustup + + - name: Install required packages + run: zypper --non-interactive install python-langtable-data openssl-3 libopenssl-3-devel jq + + - name: Install Rust toolchains + run: rustup toolchain install stable + + - name: Install cargo-binstall + uses: taiki-e/install-action@v2 + with: + tool: cargo-binstall + + - name: Install Tarpaulin (for code coverage) + run: cargo-binstall --no-confirm cargo-tarpaulin + + - name: Run the tests + run: cargo tarpaulin --out xml + + - name: Lint formatting + run: cargo fmt --all -- --check + + # send the code coverage for the Rust part to the coveralls.io + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2 + with: + base-path: ./rust + format: cobertura + flag-name: rust + parallel: true + + # close the code coverage and inherit the previous coverage for the Ruby and + # Web parts (it needs a separate step, the "carryforward" flag can be used + # only with the "parallel-finished: true" option) + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + carryforward: "service,web" diff --git a/.github/workflows/ci-service.yml b/.github/workflows/ci-service.yml new file mode 100644 index 0000000000..620a8bb75c --- /dev/null +++ b/.github/workflows/ci-service.yml @@ -0,0 +1,93 @@ +name: CI - Service + +on: + push: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used below for the pull request event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-service.yml + # any change in the service subfolder + - service/** + # except Markdown documentation + - "!service/**.md" + # except the packaging + - "!service/package/**" + # except the DBus configuration + - "!service/share/**" + + pull_request: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used above for the push event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-service.yml + # any change in the service subfolder + - service/** + # except Markdown documentation + - "!service/**.md" + # except the packaging + - "!service/package/**" + # except the DBus configuration + - "!service/share/**" + + # allow running manually + workflow_dispatch: + +jobs: + ruby_tests: + runs-on: ubuntu-latest + env: + COVERAGE: 1 + + defaults: + run: + working-directory: ./service + + strategy: + fail-fast: false + matrix: + distro: [ "tumbleweed" ] + + container: + image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby + + steps: + + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Configure and refresh repositories + # disable unused repositories to have faster refresh + run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref + + - name: Install Ruby development files + run: zypper --non-interactive install gcc gcc-c++ make openssl-devel ruby-devel npm augeas-devel + + - name: Install required packages + run: zypper --non-interactive install yast2-iscsi-client + + - name: Install RubyGems dependencies + run: bundle config set --local with 'development' && bundle install + + - name: Run the tests and generate coverage report + run: bundle exec rspec + + # send the code coverage for the Ruby part to the coveralls.io + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2 + with: + base-path: ./service + flag-name: service + parallel: true + + # close the code coverage and inherit the previous coverage for the Web and + # Rust parts (it needs a separate step, the "carryforward" flag can be used + # only with the "parallel-finished: true" option) + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + carryforward: "rust,web" diff --git a/.github/workflows/ci-web.yml b/.github/workflows/ci-web.yml new file mode 100644 index 0000000000..f003997225 --- /dev/null +++ b/.github/workflows/ci-web.yml @@ -0,0 +1,94 @@ +name: CI - Web + +on: + push: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used below for the pull request event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-web.yml + # any change in the web subfolder + - web/** + # except Markdown documentation + - "!web/**.md" + # except the packaging + - "!web/package/**" + + pull_request: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used above for the push event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-web.yml + # any change in the web subfolder + - web/** + # except Markdown documentation + - "!web/**.md" + # except the packaging + - "!web/package/**" + + # allow running manually + workflow_dispatch: + +jobs: + frontend_build: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ./web + + strategy: + matrix: + node-version: ["18.x"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: 'web/package-lock.json' + + - name: Install dependencies + run: npm install + + - name: Build the application + run: make + + - name: Run check spell + run: npm run cspell + + - name: Check types + run: npm run check-types + + - name: Run ESLint + run: npm run eslint + + - name: Run Stylelint + run: npm run stylelint + + - name: Run the tests and generate coverage report + run: npm test -- --coverage + + # send the code coverage for the web part to the coveralls.io + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2 + with: + base-path: ./web + flag-name: web + parallel: true + + # close the code coverage and inherit the previous coverage for the Ruby and + # Rust parts (it needs a separate step, the "carryforward" flag can be used + # only with the "parallel-finished: true" option) + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + carryforward: "service,rust" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index d941c5d41d..0000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,169 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - frontend_build: - runs-on: ubuntu-latest - - defaults: - run: - working-directory: ./web - - strategy: - matrix: - node-version: ["18.x"] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - cache-dependency-path: 'web/package-lock.json' - - - name: Install dependencies - run: npm install - - - name: Build the application - run: make - - - name: Run check spell - run: npm run cspell - - - name: Check types - run: npm run check-types - - - name: Run ESLint - run: npm run eslint - - - name: Run Stylelint - run: npm run stylelint - - - name: Run the tests and generate coverage report - run: npm test -- --coverage - - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v2 - with: - base-path: ./web - flag-name: frontend - parallel: true - - ruby_tests: - runs-on: ubuntu-latest - env: - COVERAGE: 1 - - defaults: - run: - working-directory: ./service - - strategy: - fail-fast: false - matrix: - distro: [ "tumbleweed" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - - steps: - - - name: Git Checkout - uses: actions/checkout@v3 - - - name: Configure and refresh repositories - # disable unused repositories to have faster refresh - run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref ) - - - name: Install Ruby development files - run: zypper --non-interactive install gcc gcc-c++ make openssl-devel ruby-devel npm augeas-devel - - - name: Install required packages - run: zypper --non-interactive install yast2-iscsi-client - - - name: Install RubyGems dependencies - run: bundle config set --local with 'development' && bundle install - - - name: Run the tests and generate coverage report - run: bundle exec rspec - - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v2 - with: - base-path: ./service - flag-name: backend - parallel: true - - rust_ci: - runs-on: ubuntu-latest - env: - COVERAGE: 1 - - defaults: - run: - working-directory: ./rust - - strategy: - fail-fast: false - matrix: - distro: [ "tumbleweed" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - options: --security-opt seccomp=unconfined - - steps: - - - name: Git Checkout - uses: actions/checkout@v3 - - - name: Configure and refresh repositories - # disable unused repositories to have faster refresh - run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref ) - - - name: Install Rust development files - run: zypper --non-interactive install rustup - - - name: Install required packages - run: zypper --non-interactive install python-langtable-data openssl-3 libopenssl-3-devel jq - - - name: Install Rust toolchains - run: rustup toolchain install stable - - - name: Install cargo-binstall - uses: taiki-e/install-action@v2 - with: - tool: cargo-binstall - - - name: Install Tarpaulin (for code coverage) - run: cargo-binstall --no-confirm cargo-tarpaulin - - - name: Run the tests - run: cargo tarpaulin --out xml - - - name: Lint formatting - run: cargo fmt --all -- --check - - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v2 - with: - base-path: ./rust - format: cobertura - flag-name: rust-backend - parallel: true - - finish: - runs-on: ubuntu-latest - - needs: [frontend_build, ruby_tests, rust_ci] - - steps: - - - name: Coveralls Finished - uses: coverallsapp/github-action@v1 - with: - parallel-finished: true