-
-
Notifications
You must be signed in to change notification settings - Fork 5
57 lines (50 loc) · 2.22 KB
/
test-tunnel.yaml
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
name: Test setup-cloudflared/tunnel
on:
push:
paths:
- tunnel/action.yaml
- tunnel/scripts/**
- shutdown/action.yaml
- .github/workflows/test-tunnel.yaml
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
type: [production, trycloudflare]
steps:
- name: Setup cloudflared using setup-cloudflared
uses: AnimMouse/setup-cloudflared@main
- name: Setup cloudflared tunnel using setup-cloudflared/tunnel
if: matrix.type == 'production'
uses: AnimMouse/setup-cloudflared/tunnel@main
with:
cloudflare_tunnel_credential: ${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIAL }}
cloudflare_tunnel_configuration: ${{ runner.os == 'macOS' && vars.CLOUDFLARE_TUNNEL_CONFIGURATION_MACOS || runner.os == 'Windows' && vars.CLOUDFLARE_TUNNEL_CONFIGURATION_WINDOWS || vars.CLOUDFLARE_TUNNEL_CONFIGURATION_UBUNTU }}
cloudflare_tunnel_id: ${{ vars.CLOUDFLARE_TUNNEL_ID }}
- name: Setup cloudflared tunnel TryCloudflare using setup-cloudflared/tunnel
if: matrix.type == 'trycloudflare'
uses: AnimMouse/setup-cloudflared/tunnel@main
with:
url: http://localhost:8080
- name: Test cloudflared tunnel using Python HTTP server for 1 minute on Unix-like
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
if [ $RUNNER_OS = macOS ]
then
function timeout(){ perl -e 'alarm shift; exec @ARGV' "$@"; }
timeout 60 python3 -m http.server 8080 || true
else
timeout 1m python -m http.server 8080 || true
fi
- name: Test cloudflared tunnel using Python HTTP server for 1 minute on Windows
if: runner.os == 'Windows'
run: |
$http_server = Start-Process "python" "-m http.server 8080" -PassThru
Wait-Process $http_server.Id -Timeout 60 -ErrorAction Ignore
$http_server.CloseMainWindow()
- name: Shutdown cloudflared using setup-cloudflared/shutdown
if: '! cancelled()'
uses: AnimMouse/setup-cloudflared/shutdown@main