Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga committed Jul 16, 2024
1 parent f2c89fd commit f0e8be5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/plugins_react_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# We could update the postinstall action for foreman to look for an environment variable for plugin webpack dirs
# before kicking off the ruby script to find them, this would eliminate the ruby dep and running `npm install` in plugins.
- uses: ruby/setup-ruby@v1
- name: "Set up Ruby ${{ matrix.ruby }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Checkout Foreman
uses: actions/checkout@v4
with:
Expand All @@ -65,12 +65,26 @@ jobs:
with:
repository: ${{ matrix.plugin }}
path: ${{ github.workspace }}/projects/plugin
- name: store plugin name
run: echo "PLUGIN_NAME=$(echo ${{ matrix.plugin }} | awk -F'/' '{print $NF}')" >> "${GITHUB_ENV}"
- name: Set up plugin in Foreman
run: |
echo "gemspec name: $PLUGIN_NAME, path: '/projects/plugin'" > "bundler.d/$PLUGIN_NAME.local.rb"
if [ -d $PLUGIN_NAME/gemfile.d ] ; then
cat $PLUGIN_NAME/gemfile.d/*.rb >> bundler.d/$PLUGIN_NAME.local.rb
fi
working-directory: ${{ github.workspace }}/projects/foreman
- name: Generate ${{ matrix.plugin }} npm dependencies package-lock
run: npm install --package-lock-only --no-audit --legacy-peer-deps
working-directory: ${{ github.workspace }}/projects/plugin
- name: Install ${{ matrix.plugin }} npm dependencies
run: npm ci --no-audit --legacy-peer-deps
working-directory: ${{ github.workspace }}/projects/plugin
- name: Install gems
run: bundle install
- name: Run plugin webpack dir to test
run: ./script/plugin_webpack_directories.rb
working-directory: ${{ github.workspace }}/projects/foreman
- name: Run ${{ matrix.plugin }} tests
run: npm run test:plugins $(echo ${{ matrix.plugin }} | awk -F'/' '{print $NF}')
working-directory: ${{ github.workspace }}/projects/foreman
3 changes: 2 additions & 1 deletion script/npm_test_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function runChildProcess(args, pluginPath) {
}
const runTests = async () => {
var dirs = packageJsonDirs();
console.log('dirs', dirs);
function pluginDefinesLint(pluginPath) {
var packageHasNodeModules = fs.existsSync(`${pluginPath}/node_modules`); // skip gems
var packageData = JSON.parse(fs.readFileSync(`${pluginPath}/package.json`));
Expand Down Expand Up @@ -125,7 +126,7 @@ const runTests = async () => {
'--color',
...passedArgs,
];

console.log('args', args);
// eslint-disable-next-line no-await-in-loop
await runChildProcess(args, pluginPath); // Run every plugin test in a separate process
if (fs.existsSync(combinedConfigPath)) {
Expand Down
12 changes: 10 additions & 2 deletions script/plugin_webpack_directories.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ var webpackedDirs = stderr => {
});
};

var getPluginDirs = stderr =>
JSON.parse(sanitizeWebpackDirs(webpackedDirs(stderr)));
var getPluginDirs = stderr => {
console.log('stderr', stderr);

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 2.7, 14)

Unexpected console statement

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 2.7, 14)

You have a misspelled word: stderr on String

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 2.7, 18)

Unexpected console statement

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 2.7, 18)

You have a misspelled word: stderr on String

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 3.0, 14)

Unexpected console statement

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 3.0, 14)

You have a misspelled word: stderr on String

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 3.0, 18)

Unexpected console statement

Check warning on line 51 in script/plugin_webpack_directories.js

View workflow job for this annotation

GitHub Actions / test (13, 3.0, 18)

You have a misspelled word: stderr on String
// console.log('webpackedDirs', webpackedDirs(stderr));
// console.log(
// 'sanitizeWebpackDirs',
// // sanitizeWebpackDirs(webpackedDirs(stderr))
// JSON.parse(sanitizeWebpackDirs(webpackedDirs(stderr)))
// );
return JSON.parse(sanitizeWebpackDirs(webpackedDirs(stderr)));
};

var packageJsonDirs = stderr =>
pluginPath('package.json')(getPluginDirs(stderr)).map(path.dirname);
Expand Down

0 comments on commit f0e8be5

Please sign in to comment.