mirror of
https://github.com/actions/github-script.git
synced 2025-12-08 08:06:23 +00:00
- Use test-specific step ids - Remove unused input parameters - Provide clear output on what passed or failed, including a step summary for each passed test.
72 lines
2.3 KiB
YAML
72 lines
2.3 KiB
YAML
name: Integration
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test-return:
|
|
name: 'Integration test: return'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- id: output-set
|
|
uses: ./
|
|
with:
|
|
script: return core.getInput('input-value')
|
|
result-encoding: string
|
|
input-value: output
|
|
- run: |
|
|
echo "- Validating output is produced"
|
|
expected="output"
|
|
if [[ "${{steps.output-set.outputs.result}}" != "$expected" ]]; then
|
|
echo $'::error::\u274C' "Expected '$expected', got ${{steps.output-set.outputs.result}}"
|
|
exit 1
|
|
fi
|
|
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY
|
|
|
|
test-relative-require:
|
|
name: 'Integration test: relative-path require'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- id: relative-require
|
|
uses: ./
|
|
with:
|
|
script: return require('./package.json').name
|
|
result-encoding: string
|
|
- run: |
|
|
echo "- Validating relative require output"
|
|
if [[ "${{steps.relative-require.outputs.result}}" != "github-script" ]]; then
|
|
echo $'::error::\u274C' "Expected '$expected', got ${{steps.relative-require.outputs.result}}"
|
|
exit 1
|
|
fi
|
|
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY
|
|
|
|
test-npm-require:
|
|
name: 'Integration test: npm package require'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
|
|
restore-keys: ${{runner.os}}-npm-
|
|
- run: npm ci
|
|
- id: npm-require
|
|
uses: ./
|
|
with:
|
|
script: return require('@actions/core/package.json').name
|
|
result-encoding: string
|
|
- run: |
|
|
echo "- Validating npm require output"
|
|
expected="@actions/core"
|
|
if [[ "${{steps.npm-require.outputs.result}}" != "$expected" ]]; then
|
|
echo $'::error::\u274C' "Expected '$expected', got ${{steps.npm-require.outputs.result}}"
|
|
exit 1
|
|
fi
|
|
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY
|