mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 12:38:24 +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
|
continue-on-error: true
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
|
||||||
- os: windows-latest
|
|
||||||
bun-version: canary
|
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
|
@ -40,12 +37,37 @@ jobs:
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Setup Bun
|
||||||
uses: ./
|
uses: ./
|
||||||
|
id: setup_bun
|
||||||
with:
|
with:
|
||||||
bun-version: ${{ matrix.bun-version }}
|
bun-version: ${{ matrix.bun-version }}
|
||||||
|
|
||||||
- name: Run Bun
|
- name: Run Bun
|
||||||
|
id: run_bun
|
||||||
run: |
|
run: |
|
||||||
bun --version
|
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:
|
setup-bun-from-package-json-version:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
@ -68,13 +68,12 @@ runAction({
|
||||||
noCache: getBooleanInput("no-cache") || false,
|
noCache: getBooleanInput("no-cache") || false,
|
||||||
})
|
})
|
||||||
.then(({ version, revision, cacheHit }) => {
|
.then(({ version, revision, cacheHit }) => {
|
||||||
console.log("Setting output");
|
|
||||||
setOutput("bun-version", version);
|
setOutput("bun-version", version);
|
||||||
setOutput("bun-revision", revision);
|
setOutput("bun-revision", revision);
|
||||||
setOutput("cache-hit", cacheHit);
|
setOutput("cache-hit", cacheHit);
|
||||||
console.log("Done");
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setFailed(error);
|
setFailed(error);
|
||||||
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
export function retry<T>(fn: () => Promise<T>, retries: number): Promise<T> {
|
export function retry<T>(fn: () => Promise<T>, retries: number): Promise<T> {
|
||||||
return fn().catch((err) => {
|
return fn().catch((err) => {
|
||||||
console.log(`Remaining retries ${retries}`);
|
|
||||||
console.log("Current error:");
|
|
||||||
console.log(err);
|
|
||||||
if (retries <= 0) {
|
if (retries <= 0) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue