diff --git a/.github/generate-test-steps.js b/.github/generate-test-steps.js index 2c31ab6e..213d76cb 100644 --- a/.github/generate-test-steps.js +++ b/.github/generate-test-steps.js @@ -17,12 +17,13 @@ function formatCommands(commands) { return commands.map((c) => "echo \"::group::" + c + "\"\n" + c + "\necho \"::endgroup::\"").join("\n"); } +const languages = {}; for (const language of readdirSync('.')) { if (!statSync(language).isDirectory()) { continue; } - const matrix = []; + const examples = []; for (const example of readdirSync(language)) { const directory = language + '/' + example @@ -48,8 +49,12 @@ for (const language of readdirSync('.')) { testCommands = formatCommands(testCommands); } - matrix.push({ example, preTestCommands, testCommands }); + examples.push({ example, preTestCommands, testCommands }); } - console.log(language + "=" + JSON.stringify(matrix)); -} \ No newline at end of file + if (examples.length > 0) { + languages[language] = examples; + } +} + +console.log("languages=" + JSON.stringify(languages)); diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index adb2247c..628402dc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ jobs: list-projects: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.build-matrix.outputs.result }} + languages: ${{ steps.build-matrix.outputs.result.languages }} steps: - uses: actions/checkout@v2 - name: discover all examples @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: ${{ fromJSON(needs.list-projects.outputs.javascript) }} + matrix: ${{ fromJSON(needs.list-projects.outputs.languages).javascript }} steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v3