@@ -11,25 +11,31 @@ jobs:
11
11
setup :
12
12
runs-on : ubuntu-latest
13
13
outputs :
14
- tool_matrix : ${{ steps.get-toolkits.outputs.toolkits }}
14
+ toolkits_with_gha_secrets : ${{ steps.load_toolkits.outputs.toolkits_with_gha_secrets }}
15
+ toolkits_without_gha_secrets : ${{ steps.load_toolkits.outputs.toolkits_without_gha_secrets }}
15
16
steps :
16
17
- name : Check out
17
18
uses : actions/checkout@v4
18
19
19
- - name : Get toolkits
20
- id : get-toolkits
20
+ - name : determine toolkits with and without GHA secrets
21
+ id : load_toolkits
21
22
run : |
22
23
# Find all directories in toolkits/ that have a pyproject.toml
23
24
TOOLKITS=$(find toolkits -maxdepth 1 -type d -not -name "toolkits" -exec test -f {}/pyproject.toml \; -exec basename {} \; | jq -R -s -c 'split("\n")[:-1]')
25
+ TOOLKITS_WITH_GHA_SECRETS='["postgres"]'
26
+ TOOLKITS_WITHOUT_GHA_SECRETS=$(echo "$TOOLKITS" | jq -c --argjson with "$TOOLKITS_WITH_GHA_SECRETS" '[.[] | select(. as $t | $with | index($t) | not)]')
24
27
echo "Found toolkits: $TOOLKITS"
25
- echo "toolkits=$TOOLKITS" >> $GITHUB_OUTPUT
28
+ echo "Found toolkits without GHA secrets: $TOOLKITS_WITHOUT_GHA_SECRETS"
29
+ echo "Found toolkits with GHA secrets: $TOOLKITS_WITH_GHA_SECRETS"
30
+ echo "toolkits_without_gha_secrets=$TOOLKITS_WITHOUT_GHA_SECRETS" >> $GITHUB_OUTPUT
31
+ echo "toolkits_with_gha_secrets=$TOOLKITS_WITH_GHA_SECRETS" >> $GITHUB_OUTPUT
26
32
27
33
test-toolkits :
28
34
needs : setup
29
35
runs-on : ubuntu-latest
30
36
strategy :
31
37
matrix :
32
- toolkit : ${{ fromJson(needs.setup.outputs.tool_matrix ) }}
38
+ toolkit : ${{ fromJson(needs.setup.outputs.toolkits_without_gha_secrets ) }}
33
39
fail-fast : true
34
40
steps :
35
41
- name : Check out
48
54
uv run --active pre-commit run -a
49
55
uv run --active mypy --config-file=pyproject.toml
50
56
51
- - name : Test toolkit
57
+ - name : Test stand-alone toolkits (no secrets)
58
+ working-directory : toolkits/${{ matrix.toolkit }}
59
+ run : |
60
+ # Run pytest and capture exit code
61
+ uv run --active pytest -W ignore -v --cov=arcade_${{ matrix.toolkit }} --cov-report=xml || EXIT_CODE=$?
62
+
63
+ if [ "${EXIT_CODE:-0}" -eq 5 ]; then
64
+ echo "No tests found for toolkit ${{ matrix.toolkit }}, skipping..."
65
+ exit 0
66
+ elif [ "${EXIT_CODE:-0}" -ne 0 ]; then
67
+ exit ${EXIT_CODE}
68
+ fi
69
+
70
+ test-toolkits-with-gha-secrets :
71
+ needs : setup
72
+ runs-on : ubuntu-latest
73
+ strategy :
74
+ matrix :
75
+ toolkit : ${{ fromJson(needs.setup.outputs.toolkits_with_gha_secrets) }}
76
+ fail-fast : true
77
+ steps :
78
+ - name : Check out
79
+ uses : actions/checkout@v4
80
+
81
+ - name : Set up the environment
82
+ uses : ./.github/actions/setup-uv-env
83
+
84
+ - name : Install toolkit dependencies
85
+ working-directory : toolkits/${{ matrix.toolkit }}
86
+ run : uv pip install -e ".[dev]"
87
+
88
+ - name : Check toolkit
89
+ working-directory : toolkits/${{ matrix.toolkit }}
90
+ run : |
91
+ uv run --active pre-commit run -a
92
+ uv run --active mypy --config-file=pyproject.toml
93
+
94
+ - name : Test stand-alone toolkits (with secrets)
95
+ if : github.repository == 'ArcadeAI/arcade-ai'
52
96
working-directory : toolkits/${{ matrix.toolkit }}
53
97
env :
54
98
TEST_POSTGRES_DATABASE_CONNECTION_STRING : ${{ secrets.TEST_POSTGRES_DATABASE_CONNECTION_STRING }} # TODO: dynamically only load the `TEST_${{ matrix.toolkit }}_DATABASE_CONNECTION_STRING secret`
0 commit comments