Skip to content

Commit 2d4df49

Browse files
committed
rewrite using tools-cache (#25)
* rewrite using tools-cache bump dependencies, more tests
1 parent e7d3b20 commit 2d4df49

19 files changed

Lines changed: 36453 additions & 11008 deletions

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
],
88
"parser": "@typescript-eslint/parser",
99
"parserOptions": {
10-
"ecmaVersion": 9,
10+
"ecmaVersion": 2020,
1111
"sourceType": "module",
1212
"project": "./tsconfig.json"
1313
},
1414
"rules": {
15+
"i18n-text/no-en": "off",
1516
"eslint-comments/no-use": "off",
1617
"import/no-namespace": "off",
1718
"no-unused-vars": "off",

.github/workflows/check_url.yml

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# name: Simple url check
21
on: [push]
32

43
jobs:
@@ -7,11 +6,48 @@ jobs:
76
timeout-minutes: 10
87
strategy:
98
matrix:
10-
os: [ubuntu-latest, ubuntu-20.04]
9+
os: [ubuntu-latest, windows-latest]
10+
steps:
11+
12+
- name: Setup Babashka
13+
id: setup-babashka-1
14+
uses: turtlequeue/setup-babashka@main
15+
with:
16+
babashka-version: 1.3.189
17+
18+
- name: Check if bb runs fine
19+
run: bb --version
20+
21+
- name: Setup Babashka from cache
22+
id: setup-babashka-2
23+
uses: turtlequeue/setup-babashka@main
24+
with:
25+
babashka-version: 1.3.189
26+
fail-on-cache-miss: true
27+
28+
- name: Check if bb runs fine from cache
29+
run: bb --version
30+
31+
- name: Test Cache
32+
run: |
33+
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
34+
echo "Cache-hit output not set in first run. Failing the job."
35+
exit 1
36+
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
37+
echo "Cache not used in the second run. Failing the job."
38+
exit 1
39+
fi
40+
shell: bash
41+
42+
check-url:
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 10
45+
strategy:
46+
matrix:
1147
babashka-url: ['https://github.com/babashka/babashka/releases/download/v1.3.189/babashka-1.3.189-linux-amd64-static.tar.gz']
1248
steps:
1349
- name: Setup Babashka
14-
id: setup-babashka
50+
id: setup-babashka-1
1551
uses: turtlequeue/setup-babashka@main
1652
with:
1753
babashka-version: 1.3.189
@@ -26,9 +62,22 @@ jobs:
2662
with:
2763
babashka-version: 1.3.189
2864
babashka-url: ${{ matrix.babashka-url }}
65+
fail-on-cache-miss: true
2966

3067
- name: Check if bb runs fine from cache
3168
run: bb --version
69+
70+
- name: Test Cache
71+
run: |
72+
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
73+
echo "Cache-hit output not set in first run. Failing the job."
74+
exit 1
75+
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
76+
echo "Cache not used in the second run. Failing the job."
77+
exit 1
78+
fi
79+
shell: bash
80+
3281
check-windows:
3382
# https://ci.appveyor.com/project/borkdude/babashka
3483
runs-on: windows-latest
@@ -37,8 +86,9 @@ jobs:
3786
babashka-url: ['https://ci.appveyor.com/api/buildjobs/hgg0343wy6uj4xog/artifacts/babashka-1.3.190-SNAPSHOT-windows-amd64.zip']
3887
steps:
3988
- name: Setup Babashka
40-
id: setup-babashka
89+
id: setup-babashka-1
4190
uses: turtlequeue/setup-babashka@main
91+
4292
with:
4393
babashka-version: 1.3.190-SNAPSHOT
4494
babashka-url: ${{ matrix.babashka-url }}
@@ -49,9 +99,22 @@ jobs:
4999
- name: Setup Babashka from cache
50100
id: setup-babashka-2
51101
uses: turtlequeue/setup-babashka@main
102+
52103
with:
53104
babashka-version: 1.3.190-SNAPSHOT
54105
babashka-url: ${{ matrix.babashka-url }}
106+
fail-on-cache-miss: true
55107

56108
- name: Check if bb runs fine from cache
57109
run: bb --version
110+
111+
- name: Test Cache
112+
run: |
113+
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
114+
echo "Cache-hit output not set in first run. Failing the job."
115+
exit 1
116+
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
117+
echo "Cache not used in the second run. Failing the job."
118+
exit 1
119+
fi
120+
shell: bash

.github/workflows/main.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ name: Main dev test
33
on: [push]
44

55
jobs:
6-
simple:
7-
runs-on: ubuntu-latest
8-
# runs-on: windows-latest
6+
maindevtest:
7+
# runs-on: ubuntu-latest
8+
runs-on: windows-latest
99
steps:
1010
- name: Setup Babashka
11+
id: setup-babashka
1112
uses: turtlequeue/setup-babashka@main
1213
with:
1314
babashka-version: 1.3.189
1415

1516
- name: Check bb runs
1617
run: bb --version
18+
19+
- name: Test Cache
20+
run: |
21+
if [ -z "${{ steps.setup-babashka.outputs.cache-hit }}" ]; then
22+
echo "Cache-hit output not set in first run. Failing the job."
23+
exit 1
24+
fi
25+
shell: bash

.github/workflows/self_check.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
os: [ubuntu-latest, ubuntu-20.04, macos-latest, windows-latest]
11-
babashka-version: [0.5.0, 1.1.172, 1.3.189]
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
babashka-version: [1.1.172, 1.3.189]
1212
steps:
1313
- name: Setup Babashka
14-
id: setup-babashka
14+
id: setup-babashka-1
1515
uses: turtlequeue/setup-babashka@main
1616
with:
1717
babashka-version: ${{ matrix.babashka-version }}
@@ -24,6 +24,18 @@ jobs:
2424
uses: turtlequeue/setup-babashka@main
2525
with:
2626
babashka-version: ${{ matrix.babashka-version }}
27+
fail-on-cache-miss: true
2728

2829
- name: Check if bb runs fine from cache
2930
run: bb --version
31+
32+
- name: Test Cache
33+
run: |
34+
if [ -z "${{ steps.setup-babashka-1.outputs.cache-hit }}" ]; then
35+
echo "Cache-hit output not set in first run. Failing the job."
36+
exit 1
37+
elif [ "${{ steps.setup-babashka-2.outputs.cache-hit }}" != "true" ]; then
38+
echo "Cache not used in the second run. Failing the job."
39+
exit 1
40+
fi
41+
shell: bash

.github/workflows/unit_test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Unit Test
2+
3+
on: [push]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-node@v4
11+
with:
12+
node-version: 20
13+
- run: yarn
14+
- run: yarn test

NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
nvm use
77
yarn install
88
yarn package
9+
nodemon -e ts --exec yarn test
910
```
1011

1112
# Test in CI

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Setup Babashka
18-
uses: turtlequeue/setup-babashka@v1.6.0
18+
uses: turtlequeue/setup-babashka@v1.7.0
1919
with:
2020
babashka-version: 1.3.189
2121

@@ -59,7 +59,7 @@ jobs:
5959
runs-on: ubuntu-latest
6060
steps:
6161
- name: Setup Babashka
62-
uses: turtlequeue/setup-babashka@v1.6.0
62+
uses: turtlequeue/setup-babashka@v1.7.0
6363
with:
6464
# this will eventually expire
6565
babashka-version: 0.8.157-SNAPSHOT

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ inputs:
1010
required: true
1111
babashka-url:
1212
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'
13+
fail-on-cache-miss:
14+
description: 'Fail the action run if the result was not returned from the cache. Useful for tests. "true" or false otherwise'
1315
runs:
1416
using: 'node20'
1517
main: 'dist/index.js'

0 commit comments

Comments
 (0)