-
-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (75 loc) · 2.6 KB
/
validate.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
name: Validate Docker Image 🐳
on:
push:
branches-ignore:
- main
- beta
workflow_dispatch:
jobs:
build:
name: Build and Validate 🏁
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Set up Docker Buildx 🛠️
uses: docker/setup-buildx-action@v3
- name: Build Docker Image 🐳
uses: docker/build-push-action@v6
env:
GAME: cstrike
with:
context: ./container
build-args: GAME=cstrike
load: true
- name: Get Docker Image ID 🆔
id: get_image_id
run: echo "image_id=$(docker images -q | head -n 1)" >> $GITHUB_ENV
- name: Add Custom Mod Content 📂
run: |
mkdir -p ./mods
mkdir -p ./mods/decay
touch ./mods/decay/plugin.ini
- name: Add Configuration 📂
run: |
mkdir -p ./config
touch ./config/test.cfg
- name: Run Docker Container 🐳
run: |
docker run -d -ti \
--name hlds ${{ env.image_id }} \
-v "$(pwd)/config:/temp/config" \
-v "$(pwd)/mods:/temp/mods" \
-p 27015:27015/udp \
-p 27015:27015 \
-p 26900:26900/udp \
-e GAME=${GAME} \
"+log on +rcon_password changeme +maxplayers 12 +map cs_italy"
- name: Inspect Container Directories 🕵️♂️
run: |
echo "Listing contents of /opt/steam:"
docker exec hlds ls /opt/steam
echo "Listing contents of /opt/steam/hlds:"
docker exec hlds ls /opt/steam/hlds
echo "Listing contents of /opt/steam/hlds/cstrike:"
docker exec hlds ls /opt/steam/hlds/cstrike
echo "Listing contents of /opt/steam/hlds/decay:"
docker exec hlds ls /opt/steam/hlds/decay
- name: Validate Directory Mappings 📂
run: |
# Check if plugin.ini exists in the decay directory
if [ "$(docker exec hlds ls /opt/steam/hlds/decay | grep -c 'plugin.ini')" -eq 0 ]; then
echo "plugin.ini file is missing in the decay directory!"
exit 1
fi
# Check if test.cfg exists in the cstrike directory
if [ "$(docker exec hlds ls /opt/steam/hlds/cstrike | grep -c 'test.cfg')" -eq 0 ]; then
echo "test.cfg file is missing in the cstrike directory!"
exit 1
fi
echo "Volume mappings work as expectected!"
- name: Cleanup 🧹
if: always()
run: |
docker stop hlds
docker rm hlds