From d5c088fd614339700c12fa0b9a15fde38ef97b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 9 Aug 2023 11:13:20 +0200 Subject: [PATCH] Run the Rubocop CI check only when a Ruby file is changed This avoids running Rubocop when it is not needed --- .github/workflows/ci-rubocop.yml | 54 ++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 23 -------------- README.md | 1 + 3 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/ci-rubocop.yml diff --git a/.github/workflows/ci-rubocop.yml b/.github/workflows/ci-rubocop.yml new file mode 100644 index 0000000000..660a71dca5 --- /dev/null +++ b/.github/workflows/ci-rubocop.yml @@ -0,0 +1,54 @@ +name: "CI - Rubocop" + +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-rubocop.yml + # Rubocop configuration + - service/.rubocop.yml + # all Ruby files + - service/Gemfile + - service/bin/agamactl + - service/**.rb + + 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-rubocop.yml + # Rubocop configuration + - service/.rubocop.yml + # all Ruby files + - service/Gemfile + - service/bin/agamactl + - service/**.rb + +jobs: + rubocop: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ./service + + strategy: + fail-fast: false + matrix: + distro: [ "leap_latest" ] + + container: + image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby + + steps: + + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Rubocop + run: /usr/bin/rubocop.*-1.24.1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71d4a62823..b8e9474eac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,29 +98,6 @@ jobs: flag-name: backend parallel: true - ruby_linter: - runs-on: ubuntu-latest - - defaults: - run: - working-directory: ./service - - strategy: - fail-fast: false - matrix: - distro: [ "leap_latest" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - - steps: - - - name: Git Checkout - uses: actions/checkout@v3 - - - name: Rubocop - run: /usr/bin/rubocop.*-1.24.1 - ruby_doc: runs-on: ubuntu-latest env: diff --git a/README.md b/README.md index 92ae0e38eb..aa6ee0380a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ **Checks** [![CI Status](https://github.com/openSUSE/agama/actions/workflows/ci.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/ci.yml) +[![CI - Rubocop](https://github.com/openSUSE/agama/actions/workflows/ci-rubocop.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/ci-rubocop.yml) [![CI - Integration Tests](https://github.com/openSUSE/agama/actions/workflows/ci-integration-tests.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/ci-integration-tests.yml) [![Coverage Status](https://coveralls.io/repos/github/openSUSE/agama/badge.svg?branch=master)](https://coveralls.io/github/openSUSE/agama?branch=master) [![GitHub Pages](https://github.com/openSUSE/agama/actions/workflows/github-pages.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/github-pages.yml)