mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 04:28:28 +02:00
add test for outputs
This commit is contained in:
parent
59d4cef3d8
commit
d530e6ad59
3 changed files with 26 additions and 8 deletions
28
.github/workflows/test.yml
vendored
28
.github/workflows/test.yml
vendored
|
@ -16,9 +16,6 @@ jobs:
|
|||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
bun-version: canary
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
|
@ -40,12 +37,37 @@ jobs:
|
|||
|
||||
- name: Setup Bun
|
||||
uses: ./
|
||||
id: setup_bun
|
||||
with:
|
||||
bun-version: ${{ matrix.bun-version }}
|
||||
|
||||
- name: Run Bun
|
||||
id: run_bun
|
||||
run: |
|
||||
bun --version
|
||||
echo "version=$(bun --version)" >> $GITHUB_OUTPUT
|
||||
echo "revision=$(bun --revision)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Check version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ steps.run_bun.outputs.version }}" == "${{ steps.setup_bun.outputs.version }}" ]]; then
|
||||
echo "Version is ${{ steps.setup_bun.outputs.version }}"
|
||||
else
|
||||
echo "Expected version to be ${{ steps.setup_bun.outputs.version }}, got ${{ steps.run_bun.outputs.version }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Check revision
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ steps.run_bun.outputs.revision }}" == "${{ steps.setup_bun.outputs.revision }}" ]]; then
|
||||
echo "Revision is ${{ steps.setup_bun.outputs.revision }}"
|
||||
else
|
||||
echo "Expected revision to be ${{ steps.setup_bun.outputs.revision }}, got ${{ steps.run_bun.outputs.revision }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
setup-bun-from-package-json-version:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
|
|
|
@ -68,13 +68,12 @@ runAction({
|
|||
noCache: getBooleanInput("no-cache") || false,
|
||||
})
|
||||
.then(({ version, revision, cacheHit }) => {
|
||||
console.log("Setting output");
|
||||
setOutput("bun-version", version);
|
||||
setOutput("bun-revision", revision);
|
||||
setOutput("cache-hit", cacheHit);
|
||||
console.log("Done");
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
setFailed(error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
export function retry<T>(fn: () => Promise<T>, retries: number): Promise<T> {
|
||||
return fn().catch((err) => {
|
||||
console.log(`Remaining retries ${retries}`);
|
||||
console.log("Current error:");
|
||||
console.log(err);
|
||||
if (retries <= 0) {
|
||||
throw err;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue