Skip to content

Commit

Permalink
rewrite using tools-cache
Browse files Browse the repository at this point in the history
bump dependencies, more tests
  • Loading branch information
nha committed Apr 1, 2024
1 parent e7d3b20 commit 4645fb5
Show file tree
Hide file tree
Showing 19 changed files with 36,460 additions and 11,015 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"ecmaVersion": 2020,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
Expand Down
79 changes: 71 additions & 8 deletions .github/workflows/check_url.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# name: Simple url check
on: [push]

jobs:
Expand All @@ -7,12 +6,49 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-latest, ubuntu-20.04]
os: [ubuntu-latest, windows-latest]
steps:

- name: Setup Babashka
id: setup-babashka-1
uses: turtlequeue/setup-babashka@feat/cache
with:
babashka-version: 1.3.189

- name: Check if bb runs fine
run: bb --version

- name: Setup Babashka from cache
id: setup-babashka-2
uses: turtlequeue/setup-babashka@feat/cache
with:
babashka-version: 1.3.189
fail-on-cache-miss: true

- name: Check if bb runs fine from cache
run: bb --version

- name: Test Cache
run: |
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
echo "Cache-hit output not set in first run. Failing the job."
exit 1
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
echo "Cache not used in the second run. Failing the job."
exit 1
fi
shell: bash

check-url:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
babashka-url: ['https://github.com/babashka/babashka/releases/download/v1.3.189/babashka-1.3.189-linux-amd64-static.tar.gz']
steps:
- name: Setup Babashka
id: setup-babashka
uses: turtlequeue/setup-babashka@main
id: setup-babashka-1
uses: turtlequeue/setup-babashka@feat/cache
with:
babashka-version: 1.3.189
babashka-url: ${{ matrix.babashka-url }}
Expand All @@ -22,13 +58,26 @@ jobs:

- name: Setup Babashka from cache
id: setup-babashka-2
uses: turtlequeue/setup-babashka@main
uses: turtlequeue/setup-babashka@feat/cache
with:
babashka-version: 1.3.189
babashka-url: ${{ matrix.babashka-url }}
fail-on-cache-miss: true

- name: Check if bb runs fine from cache
run: bb --version

- name: Test Cache
run: |
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
echo "Cache-hit output not set in first run. Failing the job."
exit 1
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
echo "Cache not used in the second run. Failing the job."
exit 1
fi
shell: bash

check-windows:
# https://ci.appveyor.com/project/borkdude/babashka
runs-on: windows-latest
Expand All @@ -37,8 +86,9 @@ jobs:
babashka-url: ['https://ci.appveyor.com/api/buildjobs/hgg0343wy6uj4xog/artifacts/babashka-1.3.190-SNAPSHOT-windows-amd64.zip']
steps:
- name: Setup Babashka
id: setup-babashka
uses: turtlequeue/setup-babashka@main
id: setup-babashka-1
uses: turtlequeue/setup-babashka@feat/cache

with:
babashka-version: 1.3.190-SNAPSHOT
babashka-url: ${{ matrix.babashka-url }}
Expand All @@ -48,10 +98,23 @@ jobs:

- name: Setup Babashka from cache
id: setup-babashka-2
uses: turtlequeue/setup-babashka@main
uses: turtlequeue/setup-babashka@feat/cache

with:
babashka-version: 1.3.190-SNAPSHOT
babashka-url: ${{ matrix.babashka-url }}
fail-on-cache-miss: true

- name: Check if bb runs fine from cache
run: bb --version

- name: Test Cache
run: |
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
echo "Cache-hit output not set in first run. Failing the job."
exit 1
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
echo "Cache not used in the second run. Failing the job."
exit 1
fi
shell: bash
17 changes: 13 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ name: Main dev test
on: [push]

jobs:
simple:
runs-on: ubuntu-latest
# runs-on: windows-latest
maindevtest:
# runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Setup Babashka
uses: turtlequeue/setup-babashka@main
id: setup-babashka
uses: turtlequeue/setup-babashka@feat/cache
with:
babashka-version: 1.3.189

- name: Check bb runs
run: bb --version

- name: Test Cache
run: |
if [ -z "${{ steps.setup-babashka.outputs.cache-hit }}" ]; then
echo "Cache-hit output not set in first run. Failing the job."
exit 1
fi
shell: bash
22 changes: 17 additions & 5 deletions .github/workflows/self_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-20.04, macos-latest, windows-latest]
babashka-version: [0.5.0, 1.1.172, 1.3.189]
os: [ubuntu-latest, macos-latest, windows-latest]
babashka-version: [1.1.172, 1.3.189]
steps:
- name: Setup Babashka
id: setup-babashka
uses: turtlequeue/setup-babashka@main
id: setup-babashka-1
uses: turtlequeue/setup-babashka@feat/cache
with:
babashka-version: ${{ matrix.babashka-version }}

Expand All @@ -21,9 +21,21 @@ jobs:

- name: Setup Babashka from cache
id: setup-babashka-2
uses: turtlequeue/setup-babashka@main
uses: turtlequeue/setup-babashka@feat/cache
with:
babashka-version: ${{ matrix.babashka-version }}
fail-on-cache-miss: true

- name: Check if bb runs fine from cache
run: bb --version

- name: Test Cache
run: |
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
echo "Cache-hit output not set in first run. Failing the job."
exit 1
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
echo "Cache not used in the second run. Failing the job."
exit 1
fi
shell: bash
14 changes: 14 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Unit Test

on: [push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: yarn
- run: yarn test
1 change: 1 addition & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
nvm use
yarn install
yarn package
nodemon -e ts --exec yarn test
```

# Test in CI
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.6.0
uses: turtlequeue/setup-babashka@v1.7.0
with:
babashka-version: 1.3.189

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.6.0
uses: turtlequeue/setup-babashka@v1.7.0
with:
# this will eventually expire
babashka-version: 0.8.157-SNAPSHOT
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ inputs:
required: true
babashka-url:
description: 'The babashka/babashka url to make available on the path. Useful for CI builds. Example https://16810-201467090-gh.circle-artifacts.com/0/release/babashka-0.3.3-SNAPSHOT-linux-amd64.tar.gz When using "babashka-url" the parameter "babashka-version" is still required, to allow for appropriate caching between runs. Example: babashka-version: 0.3.3-SNAPSHOT'
fail-on-cache-miss:
description: 'Fail the action run if the result was not returned from the cache. Useful for tests. "true" or false otherwise'
runs:
using: 'node20'
main: 'dist/index.js'
Loading

0 comments on commit 4645fb5

Please sign in to comment.