From 259ff005d10024208c1aa6a247f72e8da8e8c61b Mon Sep 17 00:00:00 2001 From: abhikdps Date: Mon, 2 Dec 2024 17:19:18 +0530 Subject: [PATCH 1/4] Add node.js setup support --- .github/workflows/tox.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index eda4d93..6ab3127 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -54,6 +54,11 @@ on: description: Command to run after test commands. required: false type: string + default_node: + default: "" + description: Path to the Node.js version file (e.g., `.tool-versions`) + required: false + type: string # keep permissions at top level because this is a composite workflow permissions: checks: read @@ -120,6 +125,12 @@ jobs: cache: ${{ hashFiles('requirements.txt', 'pyproject.toml') && 'pip' || '' }} python-version: ${{ matrix.python_version || '3.12' }} + - name: Set up Node.js + if: ${{ inputs.default_node != '' }} + uses: actions/setup-node@v3 + with: + node-version-file: ${{ inputs.default_node }} + - name: Run pre if: ${{ inputs.run_pre }} run: ${{ inputs.run_pre }} From 0418cca23b02323a444984af1dc1cfea338e6a31 Mon Sep 17 00:00:00 2001 From: abhikdps Date: Mon, 2 Dec 2024 18:26:00 +0530 Subject: [PATCH 2/4] use versions file to test changes --- .github/workflows/test.yml | 1 + .github/workflows/tox.yml | 6 +++--- .tool-versions | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .tool-versions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d255f68..d496d95 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: other_names: | docs lint + node-version-file: .tool-versions check: # This job does nothing and is only used for the branch protection if: always() diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 6ab3127..8c1ce51 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -54,7 +54,7 @@ on: description: Command to run after test commands. required: false type: string - default_node: + node-version-file: default: "" description: Path to the Node.js version file (e.g., `.tool-versions`) required: false @@ -126,10 +126,10 @@ jobs: python-version: ${{ matrix.python_version || '3.12' }} - name: Set up Node.js - if: ${{ inputs.default_node != '' }} + if: ${{ inputs.node-version-file != '' }} uses: actions/setup-node@v3 with: - node-version-file: ${{ inputs.default_node }} + node-version-file: ${{ inputs.node-version-file }} - name: Run pre if: ${{ inputs.run_pre }} diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..f31e6b0 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 20.18.0 From 3608e2a893f3059abae429dde4b545652139c2d8 Mon Sep 17 00:00:00 2001 From: abhikdps Date: Mon, 2 Dec 2024 18:47:38 +0530 Subject: [PATCH 3/4] Test with default value & passed arg --- .github/workflows/test.yml | 42 +++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d496d95..e25b856 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,18 +10,36 @@ on: jobs: test: # tests reusable tox workflow - uses: ./.github/workflows/tox.yml - with: - default_python: "3.10" - jobs_producing_coverage: 0 - max_python: "3.13" - min_python: "3.10" - run_post: echo 'Running post' - run_pre: echo 'Running pre' - other_names: | - docs - lint - node-version-file: .tool-versions + runs-on: ubuntu-latest + steps: + # Test with the default value (no `node-version-file` passed) + - name: Test with default values + uses: ./.github/workflows/tox.yml + with: + default_python: "3.10" + jobs_producing_coverage: 0 + max_python: "3.13" + min_python: "3.10" + run_post: echo 'Running post' + run_pre: echo 'Running pre' + other_names: | + docs + lint + + # Test with an explicit `node-version-file` + - name: Test with explicit node-version-file + uses: ./.github/workflows/tox.yml + with: + default_python: "3.10" + jobs_producing_coverage: 0 + max_python: "3.13" + min_python: "3.10" + run_post: echo 'Running post' + run_pre: echo 'Running pre' + other_names: | + docs + lint + node-version-file: .tool-versions check: # This job does nothing and is only used for the branch protection if: always() From 772b7a4730c7ee640f8a10161b73904ca93b2996 Mon Sep 17 00:00:00 2001 From: abhikdps Date: Mon, 2 Dec 2024 18:51:35 +0530 Subject: [PATCH 4/4] Revert --- .github/workflows/test.yml | 42 +++++++++++--------------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e25b856..d496d95 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,36 +10,18 @@ on: jobs: test: # tests reusable tox workflow - runs-on: ubuntu-latest - steps: - # Test with the default value (no `node-version-file` passed) - - name: Test with default values - uses: ./.github/workflows/tox.yml - with: - default_python: "3.10" - jobs_producing_coverage: 0 - max_python: "3.13" - min_python: "3.10" - run_post: echo 'Running post' - run_pre: echo 'Running pre' - other_names: | - docs - lint - - # Test with an explicit `node-version-file` - - name: Test with explicit node-version-file - uses: ./.github/workflows/tox.yml - with: - default_python: "3.10" - jobs_producing_coverage: 0 - max_python: "3.13" - min_python: "3.10" - run_post: echo 'Running post' - run_pre: echo 'Running pre' - other_names: | - docs - lint - node-version-file: .tool-versions + uses: ./.github/workflows/tox.yml + with: + default_python: "3.10" + jobs_producing_coverage: 0 + max_python: "3.13" + min_python: "3.10" + run_post: echo 'Running post' + run_pre: echo 'Running pre' + other_names: | + docs + lint + node-version-file: .tool-versions check: # This job does nothing and is only used for the branch protection if: always()