From 54c490753407f0d26df8a832efbdfb5279ec69bd Mon Sep 17 00:00:00 2001 From: MariaAga Date: Fri, 28 Mar 2025 15:11:55 +0000 Subject: [PATCH 1/2] feat(test): deprecation message for test package BREAKING CHANGE: Breaks test with an error explaining what to do --- packages/test/bin/tfm-test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/test/bin/tfm-test.js b/packages/test/bin/tfm-test.js index f0ad4f4f..a424ac54 100755 --- a/packages/test/bin/tfm-test.js +++ b/packages/test/bin/tfm-test.js @@ -33,3 +33,7 @@ const errorHandling = (error) => { }; runScript(getJestBin(), errorHandling, jestArgs); + +throw new Error( + '@theforeman/test package has been deprecated and will not be maintained. If you wish to continue using this packages use v15 or lower. For more information and alternatives, please refer to: https://community.theforeman.org/t/testing-plugins-from-foreman-core/43293 .' +); From 2c9dfd744a4a389cd2b2340c0e66e66d77c4c7fe Mon Sep 17 00:00:00 2001 From: MariaAga Date: Thu, 24 Jul 2025 16:27:44 +0100 Subject: [PATCH 2/2] fix(root): update github tests to use theforeman/actions BREAKING CHANGE: Uses foremans new test logic --- .github/workflows/test-with-foreman.yml | 4 +-- .github/workflows/test-with-plugins.yml | 38 ++++++++++++++++++------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-with-foreman.yml b/.github/workflows/test-with-foreman.yml index f4ac0ed4..21ac946e 100644 --- a/.github/workflows/test-with-foreman.yml +++ b/.github/workflows/test-with-foreman.yml @@ -14,7 +14,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 18.x - name: Checkout foreman-js uses: actions/checkout@v2 with: @@ -25,7 +25,7 @@ jobs: repository: theforeman/foreman path: ./projects/foreman - name: Install foreman-js npm dependencies - run: npm install + run: npm install --legacy-peer-deps working-directory: ${{ github.workspace }}/projects/foreman-js - name: Install foreman npm dependencies run: npm install diff --git a/.github/workflows/test-with-plugins.yml b/.github/workflows/test-with-plugins.yml index 6e8609e3..fbdd0c1a 100644 --- a/.github/workflows/test-with-plugins.yml +++ b/.github/workflows/test-with-plugins.yml @@ -1,6 +1,10 @@ name: Test foreman plugins with foreman-js on: [push, pull_request, workflow_dispatch] +env: + BUNDLE_WITHOUT: "console:development:journald:libvirt" + + jobs: test-plugins: runs-on: ubuntu-latest @@ -11,17 +15,16 @@ jobs: - repo: katello org: Katello use-foreman: true + ruby: 2.7 - repo: foreman-tasks org: theforeman - use-foreman: false + use-foreman: true + ruby: 2.7 steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 18.x - name: Checkout foreman-js uses: actions/checkout@v2 with: @@ -39,8 +42,21 @@ jobs: repository: ${{ matrix.org }}/${{ matrix.repo }} ref: ${{ matrix.ref }} path: ./projects/${{ matrix.repo }} + - name: Set up plugin in Foreman + run: | + echo "gemspec name: '${{ matrix.repo }}', path: '${{ github.workspace }}/projects/${{ matrix.repo }}'" > "bundler.d/${{ matrix.repo }}.local.rb" + if [ -d ${{ matrix.repo }}/gemfile.d ] ; then + cat ${{ matrix.repo }}/gemfile.d/*.rb >> bundler.d/${{ matrix.repo }}.local.rb + fi + working-directory: ${{ github.workspace }}/projects/foreman + - name: "Set up Ruby ${{ matrix.ruby }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + working-directory: ${{ github.workspace }}/projects/foreman - name: Install foreman-js npm dependencies - run: npm install + run: npm install --legacy-peer-deps working-directory: ${{ github.workspace }}/projects/foreman-js - name: Install foreman npm dependencies if: ${{ matrix.use-foreman }} @@ -48,7 +64,7 @@ jobs: working-directory: ${{ github.workspace }}/projects/foreman - name: Install ${{ matrix.repo }} npm dependencies if: ${{ matrix.repo != 'foreman' }} - run: npm install + run: npm install --legacy-peer-deps working-directory: ${{ github.workspace }}/projects/${{ matrix.repo }} - name: Link foreman-js to foreman if: ${{ matrix.use-foreman }} @@ -58,8 +74,8 @@ jobs: run: npm run link -- --location '${{ github.workspace }}/projects/${{ matrix.repo }}' working-directory: ${{ github.workspace }}/projects/foreman-js - name: Run ${{ matrix.repo }} tests - run: npm test - working-directory: ${{ github.workspace }}/projects/${{ matrix.repo }} + run: npm run test:plugins ${{ matrix.repo }} + working-directory: ${{ github.workspace }}/projects/foreman - name: Run ${{ matrix.repo }} lint - run: npm run lint - working-directory: ${{ github.workspace }}/projects/${{ matrix.repo }} + run: npm run lint:plugins ${{ matrix.repo }} + working-directory: ${{ github.workspace }}/projects/foreman