From de5ba8f8ef54c9d678663deef03f3dd878326bcb Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 10:18:40 +0100 Subject: [PATCH 01/10] Initial test commit --- .github/workflows/python-checkstyle.yml | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/python-checkstyle.yml diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml new file mode 100644 index 000000000000..e9aa848a7de1 --- /dev/null +++ b/.github/workflows/python-checkstyle.yml @@ -0,0 +1,48 @@ +name: Python checkstyle + +on: + # push: + # branches: + # - master + # paths: + # - 'java/**.java' + # - 'java/**.xml' + # - '.github/workflows/java-checkstyle.yml' + pull_request: + types: + - opened + - reopened + - synchronize + # paths: + # # We also trigger on non-java code changes since this triggers sonarcloud scanner after + # - '**.py' + # - 'web/html/src/**.ts' + # - 'web/html/src/**.tsx' + # - 'java/**.java' + # - 'java/**.xml' + # - '.github/workflows/java-checkstyle.yml' + +jobs: + checkstyle: + runs-on: ubuntu-latest + container: registry.opensuse.org/home/mczernek/containers/opensuse_factory_containerfile/uyuni-lint:latest + + steps: + - uses: actions/checkout@v4 + + # - name: Test container dependencies + # run: | + # black --version + # pylint --version + # ls -l /github/ + # echo + # echo $GITHUB_WORKSPACE + + - name: Test mounts + run: | + # echo ".workspace" && ls -l /home/runner/work/uyuni/uyuni || echo "not found" + # echo + # echo "__w" && ls -la /__w/uyuni/uyuni + pwd + git config --global --add safe.directory '*' + cd /__w/uyuni/uyuni && git status || echo "git failed" From 525b233c615415c27a021db05a1782b03e0d56e4 Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 13:30:15 +0100 Subject: [PATCH 02/10] Add file we want to test --- python/test/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/test/__init__.py b/python/test/__init__.py index e69de29bb2d1..6fd4056a7d22 100644 --- a/python/test/__init__.py +++ b/python/test/__init__.py @@ -0,0 +1 @@ +# Add comment to test black/pylint From ce69e68fcaf9e401ff44d95d03c4a33aff85aca0 Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 13:36:25 +0100 Subject: [PATCH 03/10] Collect changed pyfiles --- .github/workflows/python-checkstyle.yml | 27 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index e9aa848a7de1..629eebbe9ba5 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -29,6 +29,8 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: jitterbit/get-changed-files@v1 + id: changed_files # - name: Test container dependencies # run: | @@ -38,11 +40,22 @@ jobs: # echo # echo $GITHUB_WORKSPACE - - name: Test mounts + # - name: Test mounts + # run: | + # # echo ".workspace" && ls -l /home/runner/work/uyuni/uyuni || echo "not found" + # # echo + # # echo "__w" && ls -la /__w/uyuni/uyuni + # git config --global --add safe.directory '*' + # cd /__w/uyuni/uyuni && git status || echo "git failed" + - name: Filter python files + id: filter + run: | + echo "added=echo ${{ steps.changed_files.outputs.added }} | grep .py" >> $GITHUB_OUTPUT + echo "renamed=echo ${{ steps.changed_files.outputs.renamed }} | grep .py" >> $GITHUB_OUTPUT + echo "modified=echo ${{ steps.changed_files.outputs.modified }} | grep .py" >> $GITHUB_OUTPUT + echo "added_modified=echo ${{ steps.changed_files.outputs.added_modified }} | grep .py" >> $GITHUB_OUTPUT + - name: Print python files + env: + PY_FILES: ${{join(steps.filter.outputs.*, ' ')}} run: | - # echo ".workspace" && ls -l /home/runner/work/uyuni/uyuni || echo "not found" - # echo - # echo "__w" && ls -la /__w/uyuni/uyuni - pwd - git config --global --add safe.directory '*' - cd /__w/uyuni/uyuni && git status || echo "git failed" + echo $PY_FILES From 1a8e8056592274cab09e6f7c718235998c254d33 Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 13:40:04 +0100 Subject: [PATCH 04/10] Continue on error --- .github/workflows/python-checkstyle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index 629eebbe9ba5..c873a1b4337b 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -31,6 +31,7 @@ jobs: - uses: actions/checkout@v4 - uses: jitterbit/get-changed-files@v1 id: changed_files + continue-on-error: true # - name: Test container dependencies # run: | From 5af4ff38a2e9c4b86bd1da1e069bccf09e28d3e3 Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 13:42:25 +0100 Subject: [PATCH 05/10] Eval output --- .github/workflows/python-checkstyle.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index c873a1b4337b..84d61a769524 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -51,10 +51,10 @@ jobs: - name: Filter python files id: filter run: | - echo "added=echo ${{ steps.changed_files.outputs.added }} | grep .py" >> $GITHUB_OUTPUT - echo "renamed=echo ${{ steps.changed_files.outputs.renamed }} | grep .py" >> $GITHUB_OUTPUT - echo "modified=echo ${{ steps.changed_files.outputs.modified }} | grep .py" >> $GITHUB_OUTPUT - echo "added_modified=echo ${{ steps.changed_files.outputs.added_modified }} | grep .py" >> $GITHUB_OUTPUT + echo "added=`echo ${{ steps.changed_files.outputs.added }} | grep .py`" >> $GITHUB_OUTPUT + echo "renamed=`echo ${{ steps.changed_files.outputs.renamed }} | grep .py`" >> $GITHUB_OUTPUT + echo "modified=`echo ${{ steps.changed_files.outputs.modified }} | grep .py`" >> $GITHUB_OUTPUT + echo "added_modified=`echo ${{ steps.changed_files.outputs.added_modified }} | grep .py`" >> $GITHUB_OUTPUT - name: Print python files env: PY_FILES: ${{join(steps.filter.outputs.*, ' ')}} From 3835d85896e1c4f7001d9d8a1c5368fa4f6722a5 Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 13:49:03 +0100 Subject: [PATCH 06/10] Rely on git for file diffs --- .github/workflows/python-checkstyle.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index 84d61a769524..f713893ff1be 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -29,9 +29,9 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: jitterbit/get-changed-files@v1 - id: changed_files - continue-on-error: true + # - uses: jitterbit/get-changed-files@v1 + # id: changed_files + # continue-on-error: true # - name: Test container dependencies # run: | @@ -51,12 +51,8 @@ jobs: - name: Filter python files id: filter run: | - echo "added=`echo ${{ steps.changed_files.outputs.added }} | grep .py`" >> $GITHUB_OUTPUT - echo "renamed=`echo ${{ steps.changed_files.outputs.renamed }} | grep .py`" >> $GITHUB_OUTPUT - echo "modified=`echo ${{ steps.changed_files.outputs.modified }} | grep .py`" >> $GITHUB_OUTPUT - echo "added_modified=`echo ${{ steps.changed_files.outputs.added_modified }} | grep .py`" >> $GITHUB_OUTPUT + git config --global --add safe.directory '*' + echo "file_diff=$(git diff --name-only master... | grep .py)" >> $GITHUB_OUTPUT - name: Print python files - env: - PY_FILES: ${{join(steps.filter.outputs.*, ' ')}} run: | - echo $PY_FILES + echo ${{ steps.filter.outputs.file_diff }} From dc1194d483f6a64efe0e5bb8c825266ae97dc0ef Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 14:01:36 +0100 Subject: [PATCH 07/10] Modify git diff cmd --- .github/workflows/python-checkstyle.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index f713893ff1be..b80c783e591c 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -29,6 +29,7 @@ jobs: steps: - uses: actions/checkout@v4 + fetch-depth: 0 # - uses: jitterbit/get-changed-files@v1 # id: changed_files # continue-on-error: true @@ -52,7 +53,7 @@ jobs: id: filter run: | git config --global --add safe.directory '*' - echo "file_diff=$(git diff --name-only master... | grep .py)" >> $GITHUB_OUTPUT + echo "file_diff=$(git diff --name-only master... | grep \.py)" >> $GITHUB_OUTPUT - name: Print python files run: | echo ${{ steps.filter.outputs.file_diff }} From d1e0291ab49ccf6302b010c16178a6778d23ce45 Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 14:03:36 +0100 Subject: [PATCH 08/10] Remove other flows --- .github/workflows/acceptance_tests_common.yml | 131 ------------ .../workflows/acceptance_tests_feedback.yml | 47 ----- .../workflows/acceptance_tests_secondary.yml | 16 -- .../acceptance_tests_secondary_parallel.yml | 19 -- .../automatic-frontend-lint-fix-pr.yml | 68 ------- .github/workflows/build_containers.yml | 191 ------------------ .github/workflows/changelogs.yml | 95 --------- .github/workflows/check_translations.yml | 87 -------- .github/workflows/external_pr_labeler.yml | 31 --- .../workflows/frontend-dependency-audit.yml | 44 ---- .github/workflows/frontend-lint.yml | 47 ----- .github/workflows/java-checkstyle.yml | 62 ------ .github/workflows/javascript-build.yml | 47 ----- .github/workflows/javascript-unit-tests.yml | 53 ----- .github/workflows/labeler.yml | 14 -- .github/workflows/python-checkstyle.yml | 4 +- .github/workflows/rubocop.yml | 37 ---- .github/workflows/salt-sls-files-checks.yml | 19 -- .../schema-migration-reportdb-test-pgsql.yml | 27 --- .github/workflows/sonarcloud.yml | 66 ------ .github/workflows/stale.yml | 28 --- ...manager-sls-compatible-python26-syntax.yml | 41 ---- .../workflows/susemanager-sls-unit-tests.yml | 29 --- .github/workflows/test-covering-pr.yml | 37 ---- .github/workflows/typescript-compilation.yml | 46 ----- .github/workflows/update_translations.yml | 57 ------ 26 files changed, 2 insertions(+), 1341 deletions(-) delete mode 100644 .github/workflows/acceptance_tests_common.yml delete mode 100644 .github/workflows/acceptance_tests_feedback.yml delete mode 100644 .github/workflows/acceptance_tests_secondary.yml delete mode 100644 .github/workflows/acceptance_tests_secondary_parallel.yml delete mode 100644 .github/workflows/automatic-frontend-lint-fix-pr.yml delete mode 100644 .github/workflows/build_containers.yml delete mode 100644 .github/workflows/changelogs.yml delete mode 100644 .github/workflows/check_translations.yml delete mode 100644 .github/workflows/external_pr_labeler.yml delete mode 100644 .github/workflows/frontend-dependency-audit.yml delete mode 100644 .github/workflows/frontend-lint.yml delete mode 100644 .github/workflows/java-checkstyle.yml delete mode 100644 .github/workflows/javascript-build.yml delete mode 100644 .github/workflows/javascript-unit-tests.yml delete mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/rubocop.yml delete mode 100644 .github/workflows/salt-sls-files-checks.yml delete mode 100644 .github/workflows/schema-migration-reportdb-test-pgsql.yml delete mode 100644 .github/workflows/sonarcloud.yml delete mode 100644 .github/workflows/stale.yml delete mode 100644 .github/workflows/susemanager-sls-compatible-python26-syntax.yml delete mode 100644 .github/workflows/susemanager-sls-unit-tests.yml delete mode 100644 .github/workflows/test-covering-pr.yml delete mode 100644 .github/workflows/typescript-compilation.yml delete mode 100644 .github/workflows/update_translations.yml diff --git a/.github/workflows/acceptance_tests_common.yml b/.github/workflows/acceptance_tests_common.yml deleted file mode 100644 index 688f02fd8a07..000000000000 --- a/.github/workflows/acceptance_tests_common.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: acceptance-tests-common -on: - workflow_call: - inputs: - secondary_tests: - required: true - type: string - server_id: - required: true - type: string -env: - UYUNI_PROJECT: uyuni-project - UYUNI_VERSION: master - CUCUMBER_PUBLISH_TOKEN: ${{ secrets.CUCUMBER_PUBLISH_TOKEN }} -jobs: - paths-filter: - runs-on: ubuntu-latest - outputs: - require_acceptance_tests: ${{ steps.filter.outputs.require_acceptance_tests }} - steps: - - uses: actions/checkout@v4 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - require_acceptance_tests: - - 'java/**' - - 'web/html/src/**' - - 'testsuite/**' - - '!.github/workflows/**' - test-uyuni: - runs-on: ubuntu-22.04 - needs: paths-filter - if: needs.paths-filter.outputs.require_acceptance_tests == 'true' - steps: - - name: fix podman - run: sudo apt install podman=3.4.4+ds1-1ubuntu1 --allow-downgrades - - name: welcome_message - run: echo "Running acceptance tests. More info at https://github.com/uyuni-project/uyuni/wiki/Running-Acceptance-Tests-at-PR" - - uses: actions/checkout@v4 - - name: Cache-jar-files - uses: actions/cache@v3 - with: - path: java/buildconf/ivy/repository/ - key: ${{ runner.os }}-build-cache-uyuni-jars-${{ hashFiles('**/java/buildconf/ivy/*.xml') }} - restore-keys: | - ${{ runner.os }}-build-cache-uyuni-jars- - - - name: Cache-obs-to-maven files - uses: actions/cache@v3 - with: - path: java/.obs-to-maven-cache - key: ${{ runner.os }}-build-cache-uyuni-obs-to-maven-${{ hashFiles('**/java/buildconf/ivy/obs-maven-config.yaml') }} - restore-keys: | - ${{ runner.os }}-build-cache-uyuni-obs-to-maven- - - name: Cache-nodejs - uses: actions/cache@v3 - with: - path: web/html/src/node_modules - key: ${{ runner.os }}-build-cache-uyuni-nodejs-${{ hashFiles('**/web/html/src/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-build-cache-uyuni-nodejs- - - name: create_tmp - run: ./testsuite/podman_runner/01_setup_tmp_dirs.sh - - name: create-podman-network - run: ./testsuite/podman_runner/02_setup_network.sh - - name: start_controller - run: ./testsuite/podman_runner/03_run_controller.sh - - name: create_ssh_conf - run: ./testsuite/podman_runner/04_setup_ssh_controller.sh - - name: install_gems_in_controller - run: ./testsuite/podman_runner/05_install_gems_in_controller.sh - - name: collect_and_tag_flaky_tests_in_controller - # Until we refactor the usage of the secret, it only runs on uyuni-project/uyuni repository branches - if: github.repository == 'uyuni-project/uyuni' - run: ./testsuite/podman_runner/06_collect_and_tag_flaky_tests_in_controller.sh - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN_GALAXY_CI }} - - name: start-server-container - run: ./testsuite/podman_runner/07_start_server.sh - - name: mgr-setup - run: ./testsuite/podman_runner/08_manager_setup.sh - - name: build_code - run: ./testsuite/podman_runner/09_build_server_code.sh -# - name: copy_ca -# run: podman exec uyuni-server-all-in-one-test bash -c "cp /etc/pki/tls/certs/spacewalk.crt /tmp" -# - name: update_ca_in_controller -# run: podman exec controller-test bash -c "cat /tmp/spacewalk.crt >> /etc/ssl/ca-bundle.pem" - - name: sle-sshminion - run: ./testsuite/podman_runner/10_run_sshminion.sh - - name: test_from_host - run: curl --insecure https://localhost:8443/rhn/help/Copyright.do - - name: test_from_container - run: sudo -i podman exec opensusessh curl --insecure https://uyuni-server-all-in-one-test:443/rhn/help/Copyright.do - - name: setup_sshd - run: ./testsuite/podman_runner/11_setup_sshd.sh - - name: run_cucumber_core - run: ./testsuite/podman_runner/12_run_core_tests.sh - - name: sle-salt-minion - run: ./testsuite/podman_runner/13_run_salt_sle_minion.sh - - name: rhlike-minion - run: ./testsuite/podman_runner/14_run_salt_rhlike_minion.sh - - name: deblike-minion - run: ./testsuite/podman_runner/15_run_salt_deblike_minion.sh - - name: accept_keys - run: ./testsuite/podman_runner/16_accept_all_keys.sh - - name: run_cucumber_clients - run: ./testsuite/podman_runner/17_run_init_clients_tests.sh - - name: split_secondary - run: ./testsuite/podman_runner/19_split_secondary_p_tests.sh - - name: run_secondary_tests - run: ./testsuite/podman_runner/${{ inputs.secondary_tests }} - - name: get_server_logs - if: ${{ failure() }} - run: ./testsuite/podman_runner/20_get_server_logs.sh ${{ inputs.server_id }} - - name: get_client_logs - if: ${{ failure() }} - run: ./testsuite/podman_runner/21_get_client_logs.sh ${{ inputs.server_id }} - - name: upload_server_log_artifacts - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: server_rhn_logs_${{ inputs.server_id }} - path: /tmp/test-all-in-one/server-logs/${{ inputs.server_id }} - - name: upload_client_log_artifacts - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: client_logs_${{ inputs.server_id }} - path: ./testsuite/logs - diff --git a/.github/workflows/acceptance_tests_feedback.yml b/.github/workflows/acceptance_tests_feedback.yml deleted file mode 100644 index 6f9541328960..000000000000 --- a/.github/workflows/acceptance_tests_feedback.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: acceptance-tests-feedback -on: - pull_request_target: - paths: - - 'java/**' - - 'web/html/src/**' - - 'testsuite/**' - - '.github/workflows/acceptance_tests_secondary.yml' - - '.github/workflows/acceptance_tests_secondary_parallel.yml' - - '.github/workflows/acceptance_tests_feedback.yml' - - '.github/workflows/acceptance_tests_common.yml' - - '!java/*.changes*' -jobs: - comment: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions-cool/maintain-one-comment@v3 - with: - body: | - :wave: Hello! Thanks for contributing to our project. - Acceptance tests will take some time (aprox. 1h), please be patient :coffee: - You can see the progress at the end of this page and at https://github.com/uyuni-project/uyuni/pull/${{ github.event.pull_request.number }}/checks - Once tests finish, if they fail, you can check :eyes: the cucumber report. See the link at the output of the action. - You can also check the artifacts section, which contains the logs at https://github.com/uyuni-project/uyuni/pull/${{ github.event.pull_request.number }}/checks. - - If you are unsure the failing tests are related to your code, you can check the "reference jobs". These are jobs that run on a scheduled time with code from master. If they fail for the same reason as your build, it means the tests or the infrastructure are broken. If they do not fail, but yours do, it means it is related to your code. - - Reference tests: - - * https://github.com/uyuni-project/uyuni/actions/workflows/acceptance_tests_secondary_parallel.yml?query=event%3Aschedule - - * https://github.com/uyuni-project/uyuni/actions/workflows/acceptance_tests_secondary.yml?query=event%3Aschedule - - KNOWN ISSUES - - Sometimes the build can fail when pulling new jar files from download.opensuse.org . This is a known limitation. Given this happens rarely, when it does, all you need to do is rerun the test. Sorry for the inconvenience. - - - For more tips on troubleshooting, see the [troubleshooting guide](https://github.com/uyuni-project/uyuni/wiki/Running-Acceptance-Tests-at-PR#troubleshooting). - - Happy hacking! - - body-include: ":warning: You should not merge if acceptance tests fail to pass. :warning:" - diff --git a/.github/workflows/acceptance_tests_secondary.yml b/.github/workflows/acceptance_tests_secondary.yml deleted file mode 100644 index 8afaca0800ac..000000000000 --- a/.github/workflows/acceptance_tests_secondary.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: acceptance-tests-secondary -on: - pull_request: - types: - - opened - - reopened - - synchronize - schedule: - - cron: '0 */12 * * *' -jobs: - test-uyuni: - uses: ./.github/workflows/acceptance_tests_common.yml - with: - secondary_tests: "18_run_secondary_tests.sh" - server_id: "secondary" - diff --git a/.github/workflows/acceptance_tests_secondary_parallel.yml b/.github/workflows/acceptance_tests_secondary_parallel.yml deleted file mode 100644 index 354a008f8dc0..000000000000 --- a/.github/workflows/acceptance_tests_secondary_parallel.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: acceptance-tests-secondary-parallel -on: - pull_request: - types: - - opened - - reopened - - synchronize - schedule: - - cron: '0 */12 * * *' -jobs: - test-uyuni: - uses: ./.github/workflows/acceptance_tests_common.yml - strategy: - fail-fast: false - matrix: - set: ['1', '2', '3', '4', '5'] - with: - secondary_tests: "19_run_secondary_parallelizable_tests_subset.sh ${{ matrix.set }}" - server_id: "secondary_parallel_${{ matrix.set }}" diff --git a/.github/workflows/automatic-frontend-lint-fix-pr.yml b/.github/workflows/automatic-frontend-lint-fix-pr.yml deleted file mode 100644 index 6574c2f2a152..000000000000 --- a/.github/workflows/automatic-frontend-lint-fix-pr.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Automatic frontend lint fix PR - -on: - push: - branches: - - master - paths: - - 'web/html/src/**' - - '.github/workflows/automatic-frontend-lint-fix-pr.yml' - -jobs: - frontend_lint_fix_pr: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Get Yarn cache directory - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Use Yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: yarn --cwd web/html/src install --frozen-lockfile --prefer-offline - - # Run lint with fixes - - name: Run lint - run: yarn --cwd web/html/src lint - - # If there's any changes, create a PR, see https://github.com/marketplace/actions/create-pull-request - - name: Create PR - uses: peter-evans/create-pull-request@v4 - with: - # Delete the branch after merger - delete-branch: true - branch: automatic-frontend-lint-fix - author: "github-actions " - title: Automatic frontend lint fixes - body: | - ## What does this PR change? - - Applies automatic frontend lint fixes. - - If this PR was made in error, please reach out to [@uyuni-project/frontend](https://github.com/orgs/uyuni-project/teams/frontend). - - ## Changelogs - - The applied changes are only stylistic and do not need a changelog. - - - [x] No changelog needed - commit-message: Automatic frontend lint fixes - # Ask for a review from the user who triggered the run, in this case the person who pushed to master - reviewers: ${{ github.actor }} diff --git a/.github/workflows/build_containers.yml b/.github/workflows/build_containers.yml deleted file mode 100644 index 114dc6e32518..000000000000 --- a/.github/workflows/build_containers.yml +++ /dev/null @@ -1,191 +0,0 @@ -name: Create and publish docker images used for the CI - -on: workflow_dispatch - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-server-all-in-one-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-test-server-all-in-one - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: ./testsuite/dockerfiles/server-all-in-one/ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-and-push-server-all-in-one-dev-image: - needs: build-and-push-server-all-in-one-image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-test-server-all-in-one-dev - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: ./testsuite/dockerfiles/server-all-in-one-dev/ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - BASE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-test-server-all-in-one - VERSION=master - build-and-push-ubuntu-minion-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-test-ubuntu-minion - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: ./testsuite/dockerfiles/ubuntu-minion/ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-and-push-opensuse-minion-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-test-opensuse-minion - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: ./testsuite/dockerfiles/opensuse-minion/ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-and-push-rocky-minion-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-test-rocky-minion - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: ./testsuite/dockerfiles/rocky-minion/ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-and-push-controller-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-test-controller-dev - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: ./testsuite/dockerfiles/controller-dev/ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/changelogs.yml b/.github/workflows/changelogs.yml deleted file mode 100644 index 6f6d1de8e50b..000000000000 --- a/.github/workflows/changelogs.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Changelogs - -on: - pull_request_target: - types: [opened, edited, synchronize, reopened, closed] - # Only execute on the main branches (feature branches are excluded) - branches: - - master - # Uyuni patches - - 'Uyuni-[0-9]+.[0-9]+' - # SUSE Manager milestones - - 'Manager-[0-9]+.[0-9]+-Alpha[0-9]?' - - 'Manager-[0-9]+.[0-9]+-Beta[0-9]?' - - 'Manager-[0-9]+.[0-9]+-RC[0-9]?' - - 'Manager-[0-9]+.[0-9]+-GMC[0-9]?' - - 'Manager-[0-9]+.[0-9]+-GM[0-9]?' - # SUSE Manager releases - - 'Manager-[0-9]+.[0-9]+' - - 'Manager-[0-9]+.[0-9]+-MU-[0-9]+.[0-9]+.[0-9]+' - # Only execute on directories that have changelogs - paths: - - 'branding/**' - - 'client/**' - - 'containers/**' - - 'java/**' - - 'projects/**' - - 'proxy/**' - - 'python/**' - - 'reporting/**' - - 'schema/**' - - 'search-server/**' - - 'selinux/**' - - 'spacecmd/**' - - 'spacewalk/**' - - 'susemanager/**' - - 'susemanager-branding-oss/**' - - 'susemanager-sync-data/**' - - 'susemanager-utils/**' - - 'suseRegisterInfo/**' - - 'tftpsync/**' - - 'utils/**' - - 'uyuni/**' - - 'web/**' - -jobs: - changelog_test: - name: Test changelog entries - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - id: master - name: Get modified master changelog files - uses: Ana06/get-changed-files@v2.2.0 - with: - filter: '*.changes' - - name: Fail if the master changelog files are modified - if: steps.master.outputs.all - run: | - echo "Master changelog files cannot be modified directly." - echo "Please revert your changes on the following master changelog file(s):" - for file in ${{steps.master.outputs.all}} - do - echo " - $file" - done - echo - echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing checklogs." - exit 1 - - id: changelogs - name: Get modified changelog files - if: "!contains(github.event.pull_request.body, '[x] No changelog needed')" - uses: Ana06/get-changed-files@v2.2.0 - with: - filter: '*.changes.*' - - name: Fail if no changelog entries are added - if: steps.changelogs.conclusion == 'success' && steps.changelogs.outputs.added_modified == '' - run: | - echo "No changelog entry found. Please add the required changelog entries." - echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing checklogs." - exit 1 - - # warns the user if they merged the PR, but the changelog test failed - warn_user_if_merged: - name: Warn user if merged - if: always() && github.event.action == 'closed' && github.event.pull_request.merged == true && needs.changelog_test.result == 'failure' - needs: changelog_test - runs-on: ubuntu-latest - steps: - - name: Remind the author with a comment - uses: peter-evans/create-or-update-comment@v2 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - :warning: No changelog entry has been added. @${{ github.event.pull_request.user.login }}, please add necessary changelog entries with an additional PR. diff --git a/.github/workflows/check_translations.yml b/.github/workflows/check_translations.yml deleted file mode 100644 index 7087d08428c7..000000000000 --- a/.github/workflows/check_translations.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Check if translation is required - -on: - pull_request_target: - paths: - - 'java/code/src/com/redhat/rhn/frontend/strings/**' - - 'backend/**' - - 'client/rhel/yum-rhn-plugin/**' - - 'client/rhel/mgr-daemon/**' - - 'client/rhel/spacewalk-client-tools/**' - - 'web/**' - - 'susemanager/**' - - 'spacecmd/**' - -jobs: - run: - name: Check by trying to locally update translation files - if: github.repository == 'uyuni-project/uyuni' - runs-on: ubuntu-latest - steps: - - name: Setup tooling - run: sudo apt-get install -y make git gettext intltool python3 - - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - - name: Setup git - run: | - git config --global user.name "Galaxy CI" - git config --global user.email "galaxy-ci@suse.de" - - - name: Checkout repo - uses: actions/checkout@v4 - with: - path: 'master_repo' - - - name: Update all translations files - run: | - cd master_repo - git switch -c check_translations - git branch origin_check_translations - ADDITIONAL_SAFE_BRANCHNAME=check_translations scripts/translation/update-all-translation-strings.sh - cd .. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check if there has been changes on translation files for master - run: | - cd master_repo - trs=$(git diff origin_check_translations check_translations | wc -l) - echo "Translations needed for master: ${trs}" - echo "translations_needed_for_master=${trs}" >> $GITHUB_ENV - cd .. - - - name: Checkout PR repo - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - path: 'pr_repo' - - - name: Update all translations files for PR - run: | - cd pr_repo - git switch -c check_translations - git branch origin_check_translations - ADDITIONAL_SAFE_BRANCHNAME=check_translations scripts/translation/update-all-translation-strings.sh - cd .. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check if there has been changes on translation files - run: | - cd pr_repo - trs=$(git diff origin_check_translations check_translations | wc -l) - echo "Translations needed for PR: ${trs}" - echo "translations_needed_for_PR=${trs}" >> $GITHUB_ENV - cd .. - - - name: Add label - if: env.translations_needed_for_master != env.translations_needed_for_PR - uses: andymckay/labeler@1.0.4 - with: - add-labels: "needs-translation" - repo-token: "${{ secrets.GITHUB_TOKEN }}" - diff --git a/.github/workflows/external_pr_labeler.yml b/.github/workflows/external_pr_labeler.yml deleted file mode 100644 index 4d411abc23aa..000000000000 --- a/.github/workflows/external_pr_labeler.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: External PR labeler - -on: - pull_request_target: - types: - - opened - -jobs: - label_prs: - name: Label external PRs - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - id: is_member - name: Check if author is an org member - env: - GH_TOKEN: ${{ secrets.ORG_READ_TOKEN }} - run: | - # The following API call returns 404 if user is not a member of the uyuni-project org - # See: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user--status-codes - RESULT=`gh api orgs/uyuni-project/members/${{ github.actor }} -i | head -1 | awk '{ print $2 }'` - echo "result=$RESULT" >> "$GITHUB_OUTPUT" - - name: Label the PR - # If not a member of org - if: ${{ steps.is_member.outputs.result == 404 }} - uses: christianvuerings/add-labels@v1 - with: - labels: "community" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/frontend-dependency-audit.yml b/.github/workflows/frontend-dependency-audit.yml deleted file mode 100644 index 6b99675ea9df..000000000000 --- a/.github/workflows/frontend-dependency-audit.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Frontend dependency audit - -on: - # This is intentionally not run on `pull_request` since we don't want to block unrelated PRs with fresh audit issues - push: - branches: - - master - paths: - - 'web/html/src/package.json' - - '.github/workflows/frontend-dependency-audit.yml' - -jobs: - frontend_dependency_audit: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Get Yarn cache directory - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Use Yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: yarn --cwd web/html/src install --frozen-lockfile --prefer-offline - - # Audit will exit with non-zero if there are any vulnerabilities, whoever triggered the run will get an email by default - - name: Run audit - run: yarn audit-production-dependencies diff --git a/.github/workflows/frontend-lint.yml b/.github/workflows/frontend-lint.yml deleted file mode 100644 index 1ea56984a5b2..000000000000 --- a/.github/workflows/frontend-lint.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Frontend lint - -on: - push: - branches: - - master - paths: - - 'web/html/src/**' - - '.github/workflows/frontend-lint.yml' - pull_request: - paths: - - 'web/html/src/**' - - '.github/workflows/frontend-lint.yml' - -jobs: - frontend_lint: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Get Yarn cache directory - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Use Yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: yarn --cwd web/html/src install --frozen-lockfile --prefer-offline - - # Run lint without fixes so the job fails if there are fixes to be applied - - name: Run lint - run: yarn --cwd web/html/src lint:production diff --git a/.github/workflows/java-checkstyle.yml b/.github/workflows/java-checkstyle.yml deleted file mode 100644 index 06994b1e8fca..000000000000 --- a/.github/workflows/java-checkstyle.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Java checkstyle - -on: - push: - branches: - - master - paths: - - 'java/**.java' - - 'java/**.xml' - - '.github/workflows/java-checkstyle.yml' - pull_request: - types: - - opened - - reopened - - synchronize - paths: - # We also trigger on non-java code changes since this triggers sonarcloud scanner after - - '**.py' - - 'web/html/src/**.ts' - - 'web/html/src/**.tsx' - - 'java/**.java' - - 'java/**.xml' - - '.github/workflows/java-checkstyle.yml' - -jobs: - checkstyle: - runs-on: ubuntu-latest - container: registry.opensuse.org/systemsmanagement/uyuni/master/docker/containers/uyuni-master-pgsql:latest - - steps: - - uses: actions/checkout@v4 - - - name: Cache dependencies - id: cache-dependencies - uses: actions/cache@v3 - with: - path: java/lib - key: ${{ runner.os }}-java-lib-${{ hashFiles('java/buildconf/ivy/*.*') }} - - - name: Resolve dependencies - if: steps.cache-dependencies.outputs.cache-hit != 'true' - run: | - ant -f java/manager-build.xml ivy - - - name: Run checkstyle - run: ant -f java/manager-build.xml checkstyle - - - name: Compress build results - run: tar cf java-build.tar.gz java/build java/lib - - - name: Save PR data to file - run: | - echo "PR_NUMBER=${{ github.event.number }}" >>pr_data - echo "PR_BASE=${{ github.event.pull_request.base.ref }}" >>pr_data - - - name: Archive Java build artifacts - uses: actions/upload-artifact@v3 - with: - name: java-built-files - path: | - java-build.tar.gz - pr_data diff --git a/.github/workflows/javascript-build.yml b/.github/workflows/javascript-build.yml deleted file mode 100644 index 2a7b30827743..000000000000 --- a/.github/workflows/javascript-build.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Javascript build - -on: - push: - branches: - - master - paths: - - 'web/html/src/**' - - '.github/workflows/javascript-build.yml' - pull_request: - paths: - - 'web/html/src/**' - - '.github/workflows/javascript-build.yml' - -jobs: - javascript_build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Get Yarn cache directory - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Use Yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - - # We only install production dependencies here to simulate a situation similar to OBS/IBS - - name: Install production dependencies - run: yarn --cwd web/html/src install --force --ignore-optional --production=true --frozen-lockfile --prefer-offline - - - name: Build application - run: yarn --cwd web/html/src build diff --git a/.github/workflows/javascript-unit-tests.yml b/.github/workflows/javascript-unit-tests.yml deleted file mode 100644 index c1e674cf5a5c..000000000000 --- a/.github/workflows/javascript-unit-tests.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Javascript unit tests - -on: - push: - branches: - - master - paths: - - 'web/html/src/**' - - '.github/workflows/javascript-unit-tests.yml' - pull_request: - paths: - - 'web/html/src/**' - - '.github/workflows/javascript-unit-tests.yml' - -jobs: - javascript_unit_tests: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - # See: https://github.com/actions/cache/blob/main/examples.md#node---yarn - - name: Get Yarn cache directory - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - # FYI, caching node_modules directly instead of Yarn's cache offers no considerable speed benefit and increases the cache size - - name: Use Yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - - # This step is required even on a cache hit or the cache won't hydrate node_modules. - # `--prefer-offline` means we prefer the cache over fetching things from the network. - # See: https://stackoverflow.com/a/62244232/1470607 - - name: Install dependencies - run: yarn --cwd web/html/src install --frozen-lockfile --prefer-offline - - - name: Run tests - run: yarn --cwd web/html/src test --no-cache - env: - BABEL_ENV: 'test' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 057208eda328..000000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: "Pull Request Labeler" -on: -- pull_request_target - -jobs: - triage: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index b80c783e591c..8ffa6a8123e7 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -29,7 +29,7 @@ jobs: steps: - uses: actions/checkout@v4 - fetch-depth: 0 + # fetch-depth: 0 # - uses: jitterbit/get-changed-files@v1 # id: changed_files # continue-on-error: true @@ -53,7 +53,7 @@ jobs: id: filter run: | git config --global --add safe.directory '*' - echo "file_diff=$(git diff --name-only master... | grep \.py)" >> $GITHUB_OUTPUT + echo "file_diff=$(git diff --name-only origin/master HEAD | grep \.py)" >> $GITHUB_OUTPUT - name: Print python files run: | echo ${{ steps.filter.outputs.file_diff }} diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml deleted file mode 100644 index 19daa23d6cf5..000000000000 --- a/.github/workflows/rubocop.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: RuboCop - -on: - pull_request: - paths: - - '.github/workflows/rubocop.yml' - - 'testsuite/features/**.rb' - - 'testsuite/.rubocop.yml' - - 'testsuite/.rubocop_todo.yml' - -jobs: - rubocop: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.5' - - - name: Install Rubocop - run: | - gem install parallel -v 1.10 - gem install parser -v 3.0.0.0 - gem install rainbow -v 2.2.2 - gem install regexp_parser -v 1.8 - gem install rexml - gem install rubocop-ast -v 1.7.0 - gem install ruby-progressbar -v 1.7 - gem install unicode-display_width -v 1.4.0 - gem install rubocop -v 1.17.0 - - - name: Run RuboCop - run: | - cd testsuite - rubocop features/* diff --git a/.github/workflows/salt-sls-files-checks.yml b/.github/workflows/salt-sls-files-checks.yml deleted file mode 100644 index 5d6cf415c58e..000000000000 --- a/.github/workflows/salt-sls-files-checks.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Check the content of Salt SLS files - -on: - pull_request: - paths: 'susemanager-utils/susemanager-sls/salt/**/*.sls' - -jobs: - salt_sls_files_checks: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: mattsb42/not-grep@master - with: - config-file: ./.github/config/file-content-checks.toml - # If you don't set debug, passing checks will be hidden. - debug: true diff --git a/.github/workflows/schema-migration-reportdb-test-pgsql.yml b/.github/workflows/schema-migration-reportdb-test-pgsql.yml deleted file mode 100644 index d802509e7ecb..000000000000 --- a/.github/workflows/schema-migration-reportdb-test-pgsql.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Run schema migration tests for reportdb - -on: - pull_request: - paths: - - 'schema/reportdb/**/*' - - 'schema/spacewalk/spacewalk-schema-upgrade' - -jobs: - schema_migration_reportdb_test_pgsql: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - - uses: actions/setup-ruby@v1 - - id: files - uses: Ana06/get-changed-files@v2.1.0 - with: - filter: '*.sql' - - name: Run json generator - run: | - ruby .github/scripts/gitarro_json_gen.rb ${{ steps.files.outputs.added_modified }} - - - name: Run schema migration tests for reportdb - run: | - susemanager-utils/testing/automation/schema-migration-reportdb-test-pgsql.sh diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index e99310aaa837..000000000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Sonarcloud scan - -on: - workflow_run: - workflows: [Java checkstyle] - types: [completed] - -jobs: - - sonarcloud-scan: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }} - - steps: - - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: ${{ github.event.workflow_run.head_repository.full_name }} - ref: ${{ github.event.workflow_run.head_branch }} - fetch-depth: 0 - - - name: Download Java built artifact - uses: actions/github-script@v6 - with: - script: | - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "java-built-files" - })[0]; - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/java-built-files.zip`, Buffer.from(download.data)); - - - name: Unzip java built artifact - run: | - unzip java-built-files.zip - - - name: Unpacking the build results - run: tar xf java-build.tar.gz - - - name: Read the PR data file - run: cat pr_data >>"$GITHUB_ENV" - - - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONARQUBE_AUTH_UYUNI }} - with: - args: > - -Dsonar.junit.reportPaths="" - -Dsonar.coverage.jacoco.xmlReportPaths="" - -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} - -Dsonar.pullrequest.key=${{ env.PR_NUMBER }} - -Dsonar.pullrequest.branch=${{ github.event.workflow_run.head_branch }} - -Dsonar.pullrequest.base=${{ env.PR_BASE }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 2517c3df5744..000000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Stale PRs -on: - schedule: - - cron: '0 1 * * *' - -jobs: - stale: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: Label/close stale PRs - uses: actions/stale@v8 - with: - stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.' - close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.' - - # Stale after 60 days, close after further 10 days - days-before-pr-stale: 60 - days-before-pr-close: 10 - - # Don't work on issues (only PRs) - days-before-issue-stale: -1 - days-before-issue-close: -1 - - # Delete its branch after closing a PR - delete-branch: true diff --git a/.github/workflows/susemanager-sls-compatible-python26-syntax.yml b/.github/workflows/susemanager-sls-compatible-python26-syntax.yml deleted file mode 100644 index 124e57e97ea8..000000000000 --- a/.github/workflows/susemanager-sls-compatible-python26-syntax.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Check for non-compatible Python 2.6 in susemanager-sls Salt modules - -on: - pull_request: - types: [opened, synchronize, reopened] - paths: 'susemanager-utils/susemanager-sls/src/**/*' - -jobs: - susemanager_sls_check_non_python26_syntax: - runs-on: ubuntu-latest - container: centos:6 - steps: - # We need to use "checkout@v1" here as is the only version compatible with Python 2.6 - - name: Check out repository code - uses: actions/checkout@v1 - - - name: Configure repos from CentOS vault - run: | - cd /etc/yum.repos.d/ - sed -i 's/mirror.centos.org\/centos\/$releasever/vault.centos.org\/6.10/g' CentOS-Base.repo - sed -i 's/#baseurl/baseurl/g' CentOS-Base.repo - sed -i '/mirrorlist.*/d' CentOS-Base.repo - - - name: Configure Salt products:old repos - run: | - yum install -y git wget - cd /etc/yum.repos.d/ - wget http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/old/RHEL_6/systemsmanagement:saltstack:products:old.repo - sed -i 's/gpgcheck=1/gpgcheck=0/g' systemsmanagement:saltstack:products:old.repo - - - name: Install old Salt from products:old - run: | - yum install -y salt - - - name: Execute tests to check Python 2.6 compatiblity of custom Salt modules - run: | - cd $GITHUB_WORKSPACE/susemanager-utils/susemanager-sls/src/ - # Exclude tests and uyuni_config.py modules (which are for server and not included in susemanager-sls) - TESTS_LIST=$(find .|grep py$ | grep -v "^./tests" | grep -v "uyuni_config.py") - for i in $TESTS_LIST; do echo "Testing $i .... "; (python -m py_compile $i && echo "OK") || IS_FAILED=1; echo; done - exit $IS_FAILED diff --git a/.github/workflows/susemanager-sls-unit-tests.yml b/.github/workflows/susemanager-sls-unit-tests.yml deleted file mode 100644 index 0fe4510e0bdd..000000000000 --- a/.github/workflows/susemanager-sls-unit-tests.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Run unit tests for susemanager-sls - -on: - pull_request: - paths: 'susemanager-utils/susemanager-sls/**/*' - -jobs: - susemanager_sls_unit_tests: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install Python dependencies - run: | - python3 -m pip install --upgrade pip - pip install pytest mock pyyaml salt - - - name: Run susemanager-sls unit tests - run: | - cd susemanager-utils/susemanager-sls/test/ - pytest test_pillar_suma_minion.py - cd ../src/tests - pytest diff --git a/.github/workflows/test-covering-pr.yml b/.github/workflows/test-covering-pr.yml deleted file mode 100644 index aedc1279c52a..000000000000 --- a/.github/workflows/test-covering-pr.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: 'Suggested tests to cover this Pull Request' - -on: - pull_request_target: - paths: - - '**.java' - -jobs: - tests-covering-pr: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm i ioredis - - id: files - uses: Ana06/get-changed-files@v2.2.0 - with: - filter: '*.java' - - id: tests_covering_pr - name: Tests covering PR - env: - REDIS_USER: ${{ secrets.REDIS_USER }} - REDIS_PASS: ${{ secrets.REDIS_PASS }} - REDIS_HOST: ${{ secrets.REDIS_HOST }} - REDIS_PORT: ${{ secrets.REDIS_PORT }} - run: echo "result=$(node .github/scripts/test_covering_pr.js ${{ steps.files.outputs.added_modified }})" >> $GITHUB_OUTPUT - - name: Write a comment into the Pull Request - uses: actions-cool/maintain-one-comment@v3 - with: - body: | - ${{ steps.tests_covering_pr.outputs.result }} - body-include: '' diff --git a/.github/workflows/typescript-compilation.yml b/.github/workflows/typescript-compilation.yml deleted file mode 100644 index 0e512cc25973..000000000000 --- a/.github/workflows/typescript-compilation.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Typescript compilation - -on: - push: - branches: - - master - paths: - - 'web/html/src/**' - - '.github/workflows/typescript-compilation.yml' - pull_request: - paths: - - 'web/html/src/**' - - '.github/workflows/typescript-compilation.yml' - -jobs: - typescript_compilation: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Get Yarn cache directory - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Use Yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: yarn --cwd web/html/src install --frozen-lockfile --prefer-offline - - - name: Compile Typescript - run: yarn --cwd web/html/src tsc diff --git a/.github/workflows/update_translations.yml b/.github/workflows/update_translations.yml deleted file mode 100644 index d864376a2b4a..000000000000 --- a/.github/workflows/update_translations.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Update translation files - -on: - push: - branches: - - master-weblate - paths: - - 'web/po/*.po' - - 'backend/po/*.po' - - 'susemanager/po/*.po' - - 'spacecmd/po/*.po' - - 'java/code/src/com/redhat/rhn/frontend/strings/database/StringResource_*.xml' - - '!java/code/src/com/redhat/rhn/frontend/strings/database/StringResource_en_US.xml' - - 'java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_*.xml' - - '!java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml' - - 'java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_*.xml' - - '!java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml' - - 'java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_*.xml' - - '!java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml' - - 'java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_*.xml' - - '!java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_en_US.xml' - - 'client/rhel/yum-rhn-plugin/po/*.po' - - 'client/rhel/mgr-daemon/po/*.po' - - 'client/rhel/spacewalk-client-tools/po/*.po' - -jobs: - run: - name: Update translation files - if: github.repository == 'uyuni-project/uyuni' - runs-on: ubuntu-latest - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.10.0 - with: - access_token: ${{ github.token }} - - - name: Checkout repo - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_TOKEN_GALAXY_CI }} - - - name: Setup tooling - run: sudo apt-get install -y make git gettext intltool python3 - - - name: Setup git - run: | - git config --global user.name "Galaxy CI" - git config --global user.email "galaxy-ci@suse.de" - - - name: Align translations files - run: scripts/translation/update-all-translation-strings.sh - env: - ADDITIONAL_SAFE_BRANCHNAME: master - GITHUB_TOKEN: ${{ secrets.GH_TOKEN_GALAXY_CI }} - - - name: Push changes - run: git push origin HEAD From 66c08ec1f31eb2fc3fe178996214f46851ff3dcf Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 14:32:16 +0100 Subject: [PATCH 09/10] test get-changed-files filter --- .github/workflows/python-checkstyle.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index 8ffa6a8123e7..c5602742edb8 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -29,6 +29,11 @@ jobs: steps: - uses: actions/checkout@v4 + + - id: files + uses: Ana06/get-changed-files@v2.2.0 + with: + filter: '*.py' # fetch-depth: 0 # - uses: jitterbit/get-changed-files@v1 # id: changed_files @@ -49,11 +54,7 @@ jobs: # # echo "__w" && ls -la /__w/uyuni/uyuni # git config --global --add safe.directory '*' # cd /__w/uyuni/uyuni && git status || echo "git failed" - - name: Filter python files - id: filter - run: | - git config --global --add safe.directory '*' - echo "file_diff=$(git diff --name-only origin/master HEAD | grep \.py)" >> $GITHUB_OUTPUT - name: Print python files run: | - echo ${{ steps.filter.outputs.file_diff }} + echo ${{ steps.files.outputs.all }} + black --check --diff -t py36 ${{ steps.files.outputs.all }} From 3c75186088cdf9873c8d6124845404defbe1c1cc Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Mon, 15 Jan 2024 14:37:08 +0100 Subject: [PATCH 10/10] finalize workflow --- .github/workflows/python-checkstyle.yml | 50 +++++++------------------ 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/.github/workflows/python-checkstyle.yml b/.github/workflows/python-checkstyle.yml index c5602742edb8..b82b30d226d5 100644 --- a/.github/workflows/python-checkstyle.yml +++ b/.github/workflows/python-checkstyle.yml @@ -1,26 +1,18 @@ name: Python checkstyle on: - # push: - # branches: - # - master - # paths: - # - 'java/**.java' - # - 'java/**.xml' - # - '.github/workflows/java-checkstyle.yml' + push: + branches: + - master + paths: + - '**.py' pull_request: types: - opened - reopened - synchronize - # paths: - # # We also trigger on non-java code changes since this triggers sonarcloud scanner after - # - '**.py' - # - 'web/html/src/**.ts' - # - 'web/html/src/**.tsx' - # - 'java/**.java' - # - 'java/**.xml' - # - '.github/workflows/java-checkstyle.yml' + paths: + - '**.py' jobs: checkstyle: @@ -29,32 +21,16 @@ jobs: steps: - uses: actions/checkout@v4 - + - id: files uses: Ana06/get-changed-files@v2.2.0 with: filter: '*.py' - # fetch-depth: 0 - # - uses: jitterbit/get-changed-files@v1 - # id: changed_files - # continue-on-error: true - # - name: Test container dependencies - # run: | - # black --version - # pylint --version - # ls -l /github/ - # echo - # echo $GITHUB_WORKSPACE - - # - name: Test mounts - # run: | - # # echo ".workspace" && ls -l /home/runner/work/uyuni/uyuni || echo "not found" - # # echo - # # echo "__w" && ls -la /__w/uyuni/uyuni - # git config --global --add safe.directory '*' - # cd /__w/uyuni/uyuni && git status || echo "git failed" - - name: Print python files + - name: Run black on files run: | - echo ${{ steps.files.outputs.all }} black --check --diff -t py36 ${{ steps.files.outputs.all }} + + - name: Run pylint on files + run: | + pylint --rcfile=/root/.pylintrc ${{ steps.files.outputs.all }}