This repository has been archived by the owner on May 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
129 lines (117 loc) · 3.27 KB
/
pull-request.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build docker
on:
pull_request:
# push:
# paths-ignore:
# - '.github/**'
# #much of the time it does not affect docker builds
# - 'internal/ui/**'
jobs:
build-go:
name: Build go binary
runs-on: ubuntu-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v3
-
name: Install robotgo
run: |
set -o pipefail
sudo apt-get update; \
sudo apt-get install -y xvfb \
libx11-dev libx11-dev xorg-dev libxtst-dev xsel xclip libpng++-dev xcb libxcb-xkb-dev x11-xkb-utils \
libx11-xcb-dev libxkbcommon-x11-dev libxkbcommon-dev;
shell: bash
-
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
#TODO: Find a way to test this before building
-
name: Build binary
run: go build -v ./
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: gobinary
path: ./warp
retention-days: 5
build-certs:
name: Build self-signed certs
runs-on: ubuntu-latest
steps:
-
name: Install mkcert
run: |
set -o pipefail
sudo apt-get update; \
sudo apt-get install wget; \
sudo wget -nv -O /usr/local/bin/mkcert https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64; \
sudo chmod +x /usr/local/bin/mkcert;
shell: bash
-
name: Create certs
run: |
set -o pipefail
mkdir ./certs && cd ./certs
mkcert -cert-file localhost.crt -key-file localhost.key localhost 127.0.0.1 ::1
shell: bash
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: certfiles
path: certs/
retention-days: 5
build-docker-nvidia:
name: Build nvidia base image
needs:
- build-go
- build-certs
runs-on: ubuntu-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v3
-
name: Download go binary
uses: actions/download-artifact@v3
with:
name: gobinary
path: ./
-
name: Download certs folder
uses: actions/download-artifact@v3
with:
name: certfiles
path: ./
-
name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build Docker image
uses: docker/build-push-action@v4
with:
context: ./
file: docker/nvidia/Dockerfile
push: false
load: true
tags: warp:nvenc
-
name: Run Docker Container
#error code 124 is timeout error
run: |
set -o pipefail
output=$(timeout 2m docker run warp:nvenc 2>&1) || exitcode=$?
if [[ $exitcode != 0 && $exitcode != 124 ]]; then
echo "$output"
exit $exitcode
else
echo "$output"
echo -e "\033[01;34mDocker run successful\033[0m"
exit 0
fi
shell: bash