Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create 'test.yml' reusable workflow #49

Open
3 tasks
oscard0m opened this issue Jul 16, 2023 · 0 comments · May be fixed by #13
Open
3 tasks

Create 'test.yml' reusable workflow #49

oscard0m opened this issue Jul 16, 2023 · 0 comments · May be fixed by #13

Comments

@oscard0m
Copy link
Member

oscard0m commented Jul 16, 2023

📖 Description

Create a reusable test.yml workflow to be used across all the repositories of Octokit.js ecosystem.

🏁 Goal

  1. To centralize GitHub Workflows used across repositories in Octokit so we can easily maintain them in a single point
  2. To reduce the noise Renovatebot produces when a third-party GitHub Action inside our workflows has an update1.

🔭 Scope

  • As a first step, this re-usable workflow will support octokit/*{.js|.ts} only.
  • Runs npm run lint --if-present
  • Runs npm run build --if-present (context here)

🔮 Future work

  • Compose actions/checkout and actions/setup-node and evaluate the execution time (more info here)
  • Extend this workflow to support the remaining octokit/* of the JS Ecosystem (more info here)
  • To evaluate the type-only test with tsd (context here)

🚚 Migration Plan

WIP

💬 Discussion points / 🚫 Blockers

Parametrize node_versions [Solved ✅]

The idea would be to parametrize the node_versions for strategy.matrix but apparently, GitHub Action Inputs do not support string[] as an input type (see here, here and here).

Conclusion 🧑‍⚖️

We are using `fromJSON` helper (details [here](https://github.com//pull/13#discussion_r922566626))

Custom steps in test.yml [Solved ✅]

Right now, most of our test.yml used across Octokit.js repositories have the following code:

name: Test
jobs:
  test_matrix:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node_version:
          - 18
          - 20
    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node_version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node_version }}
          cache: npm
      - run: npm ci
      - run: npm test
  test:
    runs-on: ubuntu-latest
    needs: test_matrix
    steps:
      - run: exit 1
        if: ${{ needs.test_matrix.result != 'success' }}
      - uses: actions/checkout@v3
      - run: npm ci
      - run: npm run lint
    if: ${{ always() }}

But there are some repositories which have extra steps or different steps:

  • What approach do we want to follow for custom steps?
    1. Extra custom-test workflows which extend a generic test.yml?
    2. Add extra logic to test.yml to give support to all the use cases?

Conclusion 🧑‍⚖️

- We want to support all the use cases by adding extra logic (more details [here](https://github.com//pull/13#issuecomment-1186010553)). - As a first step, we will focus on octokit/*{.js|.ts} repositories

Footnotes

  1. https://github.com/orgs/octokit/teams/js-community/discussions/11?from_comment=12

@oscard0m oscard0m linked a pull request Jul 16, 2023 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant