-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
58 lines (47 loc) · 1.5 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Shuttle Run
description: "Runs a shuttle project."
inputs:
cargo-shuttle-version:
description: "Use a specific version of Shuttle."
required: false
default: ""
secrets:
description: "Contents of `Secrets.toml` file."
required: false
default: ""
runs:
using: "composite"
steps:
- name: Install binstall.
uses: cargo-bins/cargo-binstall@main
- name: Install cargo-shuttle.
if: ${{ inputs.cargo-shuttle-version == '' }}
run: cargo binstall -y --locked cargo-shuttle
shell: bash
- name: Install cargo-shuttle with specific version.
if: ${{ inputs.cargo-shuttle-version != '' }}
run: cargo binstall -y --locked cargo-shuttle@${{ inputs.cargo-shuttle-version }}
shell: bash
- name: Create secrets.toml.
if: ${{ inputs.secrets != '' }}
run: echo "${{ inputs.secrets }}" > Secrets.toml
shell: bash
- name: Run project.
run: cargo shuttle run &
shell: bash
- name: Check for server start
run: |
echo "Waiting for server to start..."
timeout=180 # Timeout after 2 minutes
interval=5 # Check every 5 seconds
elapsed=0
while ! curl --silent --fail localhost:8000; do
sleep $interval
elapsed=$((elapsed + interval))
if [ $elapsed -ge $timeout ]; then
echo "Server failed to start within $timeout seconds."
exit 1
fi
done
echo "Server is up and running."
shell: bash