-
Notifications
You must be signed in to change notification settings - Fork 19
63 lines (52 loc) · 1.8 KB
/
test-on-server.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
58
59
60
61
62
63
name: Test on server
on:
workflow_dispatch:
inputs:
git_clone_arg:
description: "git clone <your argument> (example: https://github.com/unixporn/robbb.git)"
required: true
git_tag:
description: "git tag (example: master or commit like 097803edee03e25b086e1a674c3091a458e0da9f)"
required: true
environment_vars:
description: "Environment variables for the bot (example: CHANNEL_SAY_HI=blabla CHANNEL_RULES=blabla)"
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone target repository
run: |
git clone "${{github.event.inputs.git_clone_arg}}" .
git checkout "${{github.event.inputs.git_tag}}"
- name: Install rust stable
uses: actions-rs/toolchain@v1
- uses: Swatinem/rust-cache@v2
with:
key: test-on-server
- name: Build
run: |
VERSION="${{github.event.inputs.git_clone_arg}}#${{github.event.inputs.git_tag}} $(git log --format=oneline -n 1 HEAD)" cargo build --locked
- uses: actions/upload-artifact@v4
with:
name: executable
path: target/debug/robbb
run:
needs: build
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout our repository
uses: actions/checkout@v4
- run: sudo apt-get install -y jq
- name: Generate environment variables
run: |
echo -e "${{secrets.GUILD}}\n${{secrets.TOKEN}}\n" | ./gen-env.sh >.env
- uses: actions/download-artifact@v4
with:
name: executable
- name: Start the bot
run: |
export $(cat .env) ${{github.event.inputs.environment_vars}} && chmod +x ./robbb
mkdir $ATTACHMENT_CACHE_PATH
timeout $((60 * 60)) ./robbb || exit 0