-
Notifications
You must be signed in to change notification settings - Fork 9
74 lines (63 loc) · 2.47 KB
/
ci.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
name: CI
on:
pull_request:
push:
branches:
- 'main'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install flake8
run: pip install flake8
- name: Run flake8
run: flake8
- name: Install requirements
run: pip install -e .
- name: Run tests
run: python -m unittest discover -s randobot/tests -p 'test_*.py'
deploy:
runs-on: ubuntu-latest
needs: build
if: github.repository == 'wooferzfg/tww-rando-bot' && github.ref == 'refs/heads/main'
concurrency: deploy
steps:
- name: Checkout commit
uses: actions/checkout@v3
# For initial setup, launch an Amazon Linux 2 AMI instance and run the following commands:
#
# sudo yum install -y docker git
# sudo service docker start
# sudo usermod -aG docker ec2-user
# sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# sudo chmod o+rwx /usr/local/bin/docker-compose
- name: Deploy using SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_ADDRESS }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_RSA_KEY }}
script: |
docker stop $(docker ps -aq) || true
docker rm $(docker ps -aq) || true
docker system prune -af || true
sudo rm -r tww-rando-bot || true
git clone --recursive https://github.com/wooferzfg/tww-rando-bot.git
echo "${{ secrets.WWRANDO_SEED_KEY }}" > tww-rando-bot/wwrando/keys/seed_key.py
echo "${{ secrets.WWRANDO_MP_SEED_KEY }}" > tww-rando-bot/wwrando-mixed-pools/keys/seed_key.py
echo "${{ secrets.WWRANDO_DEV_TANJO3_SEED_KEY }}" > tww-rando-bot/wwrando-dev-tanjo3/keys/seed_key.py
echo "${{ secrets.WWRANDO_RS_SEED_KEY }}" > tww-rando-bot/wwrando-random-settings/keys/seed_key.py
cd tww-rando-bot
docker-compose build --no-cache
export GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN }}
export CLIENT_ID=${{ secrets.RACETIME_CLIENT_ID }}
export CLIENT_SECRET=${{ secrets.RACETIME_CLIENT_SECRET }}
docker-compose up -d