Skip to content

Commit c638302

Browse files
ci: introduce new test workflow for testing all things
1 parent e9d353c commit c638302

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

.github/workflows/test-all.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Run all tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "main"
8+
- "rc"
9+
- "hotfix-rc"
10+
workflow_dispatch:
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
test:
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
settings:
28+
- os: macos-15
29+
- os: windows-2025
30+
- os: ubuntu-24.04
31+
32+
runs-on: ${{ matrix.settings.os }}
33+
name: Run all tests - ${{ matrix.settings.os }}
34+
steps:
35+
- name: Checkout repo
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
- name: Run tests
38+
working-directory: ${{ github.workspace }}
39+
run: ./scripts/bootstrap.sh all csharp

languages/csharp/setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/usr/bin/env bash
2+
export DOTNET_CLI_TELEMETRY_OPTOUT=true
3+
export DOTNET_NOLOGO=false
4+
25
dotnet build --verbosity quiet

scripts/bootstrap.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# shellcheck disable=SC3043,SC3044
2+
# shellcheck disable=SC3043,SC3044,SC2155
33
set -euo pipefail
44

55
REPO_ROOT="$(git rev-parse --show-toplevel)"
@@ -32,6 +32,17 @@ common_setup() {
3232
cargo build --quiet >/dev/null
3333
}
3434

35+
start_fake_server() {
36+
# Start the fake server in background for testing
37+
cargo run --bin fake-server &
38+
echo $! > "${TMP_DIR}"/fake_server.pid
39+
# Wait for server to start
40+
until curl -s "$SERVER_URL/health" >/dev/null 2>&1; do
41+
echo "Waiting for fake server to start..."
42+
sleep 1
43+
done
44+
}
45+
3546
main() {
3647
local action="$1"
3748
local language="$2"
@@ -75,6 +86,9 @@ main() {
7586
echo "Failed to change directory to $dir"
7687
exit 1
7788
}
89+
90+
start_fake_server
91+
7892
. "$dir/test.sh"
7993
popd >/dev/null || {
8094
echo "Failed to return to previous directory"
@@ -88,4 +102,19 @@ main() {
88102
esac
89103
}
90104

105+
cleanup() {
106+
# Stop the fake server if it was started
107+
if [ -f "${TMP_DIR}/fake_server.pid" ]; then
108+
local pid="$(cat "${TMP_DIR}/fake_server.pid")"
109+
echo "Stopping fake server..."
110+
kill "$pid"
111+
wait "$pid" || true
112+
rm -f "${TMP_DIR}/fake_server.pid"
113+
fi
114+
115+
# Remove temporary directory
116+
rm -rf "${TMP_DIR}"
117+
}
118+
119+
trap 'cleanup' EXIT
91120
main "$@"

0 commit comments

Comments
 (0)