Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: action
path: action.yml
path: |
action.yml
measure/
test:
name: 'Test: package manager ${{ matrix.package-manager }}'
strategy:
Expand All @@ -31,7 +33,10 @@ jobs:
with:
repository: gabrielrufino/node-template
- uses: actions/download-artifact@v4
- uses: ./action/
with:
name: action
path: .
- uses: ./
with:
package-manager: ${{ matrix.package-manager }}
test-using-except:
Expand All @@ -44,7 +49,10 @@ jobs:
with:
repository: gabrielrufino/node-template
- uses: actions/download-artifact@v4
- uses: ./action/
with:
name: action
path: .
- uses: ./
with:
except: build
test-in-different-operating-systems:
Expand All @@ -60,7 +68,10 @@ jobs:
with:
repository: gabrielrufino/node-template
- uses: actions/download-artifact@v4
- uses: ./action/
with:
name: action
path: .
- uses: ./

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
32 changes: 12 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,24 @@ runs:
echo "scripts=$scripts" >> $GITHUB_OUTPUT
shell: bash
- id: install
run: |
start=$(date +%s)
${{ steps.package-manager.outputs.install_cmd }}
echo "duration=$(( $(date +%s) - start ))" >> $GITHUB_OUTPUT
shell: bash
uses: ./measure
with:
run: ${{ steps.package-manager.outputs.install_cmd }}
- id: build
if: ${{ contains(steps.scripts.outputs.scripts, 'build') && !contains(inputs.except, 'build') }}
run: |
start=$(date +%s)
${{ steps.package-manager.outputs.pkg_cmd }} run build
echo "duration=$(( $(date +%s) - start ))" >> $GITHUB_OUTPUT
shell: bash
uses: ./measure
with:
run: ${{ steps.package-manager.outputs.pkg_cmd }} run build
- id: lint
if: ${{ contains(steps.scripts.outputs.scripts, 'lint') && !contains(inputs.except, 'lint') }}
run: |
start=$(date +%s)
${{ steps.package-manager.outputs.pkg_cmd }} run lint
echo "duration=$(( $(date +%s) - start ))" >> $GITHUB_OUTPUT
shell: bash
uses: ./measure
with:
run: ${{ steps.package-manager.outputs.pkg_cmd }} run lint
- id: test
if: ${{ contains(steps.scripts.outputs.scripts, 'test') && !contains(inputs.except, 'test') }}
run: |
start=$(date +%s)
${{ steps.package-manager.outputs.pkg_cmd }} test
echo "duration=$(( $(date +%s) - start ))" >> $GITHUB_OUTPUT
shell: bash
uses: ./measure
with:
run: ${{ steps.package-manager.outputs.pkg_cmd }} test
- run: ${{ steps.package-manager.outputs.pkg_cmd }} run test:e2e
if: ${{ contains(steps.scripts.outputs.scripts, 'test:e2e') && !contains(inputs.except, 'test:e2e') }}
shell: bash
Expand Down
19 changes: 19 additions & 0 deletions measure/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Measure'
description: 'Runs a command and measures its duration'
inputs:
run:
required: true
description: 'The command to run'
outputs:
duration:
description: 'Duration of the command in seconds'
value: ${{ steps.run.outputs.duration }}
runs:
using: composite
steps:
- id: run
run: |
start=$(date +%s)
${{ inputs.run }}
echo "duration=$(( $(date +%s) - start ))" >> $GITHUB_OUTPUT
shell: bash
Loading