Replies: 2 comments
-
I have a proposed workflow. I'm going to highlight the differences and features. Proposed Workflow (raw version)name: Essential Test
on: workflow_call
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- name: Lint
run: npx nx lint
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: npx nx build
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16, 18]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
- run: npx nx test --code-coverage
e2e-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16, 18]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
- run: npx nx e2e ngx-deploy-npm-e2e Implementationname: PR's
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
pr-test:
uses: ./.github/workflows/basic-test.yml
Principal DifferencesParallel testBy executing jobs in parallel, we reduce the execution time to the one that takes longer to complete. Node V14, 16, 18Currently, those are the node versions receiving active maintenance. Those versions could be an input to the workflow with those values as default. Execute Lint and Build onceExecuting Lint tests in different node versions will result in the same output; nothing will change. The same thing happened with the build, running it in a separate node versions doesn't add too much value, especially if we have our node version specified (using |
Beta Was this translation helpful? Give feedback.
-
Thanks @dianjuar! This is in fact interesting. Anyway, it could be interesting to split back again, and then we could dive into optimizing the Node setup. We'd be happy to merge your PR. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
I have a proposition to make test action around 42% faster ⚡.
Currently, we have all the tests on an action. All tests are executed sequentially. The final time execution will be the sum of lint, test, and build execution. For this repository is 2:03min.
If we run the tests in parallel, the final execution time would be the slowest of the three. For this repository would be the linter with 52.51s.
I propose to create a reusable workflow to run all the tests in parallel. I am already implementing this approach on ngx-deploy-npm. Graphically it looks like this:
Besides the efficiency, we have the following benefits:
Beta Was this translation helpful? Give feedback.
All reactions