Skip to content

Commit

Permalink
add test for outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Apr 2, 2024
1 parent 59d4cef commit d530e6a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
continue-on-error: true
strategy:
matrix:
include:
- os: windows-latest
bun-version: canary
os:
- ubuntu-latest
- macos-latest
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
3 changes: 0 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down

0 comments on commit d530e6a

Please sign in to comment.