Add the rest
This commit is contained in:
113
.github/workflows/deploy.yaml
vendored
Normal file
113
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
name: test and deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
# Set up for manual running, just in case. Can be removed later
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
# test locally on the runner, using miniconda
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.11.5]
|
||||
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@v4.1.1
|
||||
- name: Set up conda /w python version 3.11.5
|
||||
uses: https://github.com/conda-incubator/setup-miniconda@v3.0.2
|
||||
with:
|
||||
miniconda-version: "latest"
|
||||
activate-environment: raid-callouts
|
||||
environment-file: environment.yml
|
||||
python-version: 3.11.5
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash -l {0}
|
||||
run: |
|
||||
conda env create --file environment.yml -n test-helper-module
|
||||
conda init
|
||||
conda activate test-helper-module
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: add database.ini
|
||||
shell: bash -l {0}
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/
|
||||
touch database.ini
|
||||
echo "${{ secrets.DATABASE_INI }}" >> xiv-database.ini
|
||||
|
||||
- name: Run tests
|
||||
shell: bash -l {0}
|
||||
run: |
|
||||
conda activate test-helper-module
|
||||
python -m pytest src/py/db_helper_tests.py
|
||||
|
||||
# Checkout the repo, add the dependency files, push to host, build + run (via docker compose up)
|
||||
push-and-build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: "test"
|
||||
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- uses: https://github.com/shimataro/ssh-key-action@v2.7.0
|
||||
with:
|
||||
key: ${{ secrets.HOST_PRIVATEKEY }}
|
||||
known_hosts: ${{ secrets.SSH_HOST }}
|
||||
|
||||
- name: install rsync
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install rsync -y
|
||||
|
||||
- name: add xiv database.ini
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/
|
||||
touch database.ini
|
||||
echo "${{ secrets.DATABASE_INI }}" >> xiv-database.ini
|
||||
|
||||
- name: add ffxiv discord token
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/
|
||||
echo "${{ secrets.DISCORD_TOKEN }}" >> xiv-discord.token
|
||||
|
||||
- name: add dnd database.ini
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/
|
||||
touch database.ini
|
||||
echo "${{ secrets.DND_DATABASE_INI }}" >> dnd-database.ini
|
||||
|
||||
- name: add dnd discord token
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/
|
||||
echo "${{ secrets.DND_DISCORD_TOKEN }}" >> dnd-discord.token
|
||||
|
||||
- name: add known hosts to runner
|
||||
run: |
|
||||
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
# This is set to continue even w/ error, because there is a chance that docker compose down doesn't completely work
|
||||
- name: remove old image from host
|
||||
run: |
|
||||
ssh -v ${{ secrets.HOST_USER }}@${{ secrets.SSH_HOST }} "cd /home/${{ secrets.HOST_USER }}/runner/raid-callouts && docker compose down"
|
||||
continue-on-error: true
|
||||
|
||||
- name: clean build directory on host
|
||||
run: |
|
||||
ssh ${{ secrets.HOST_USER }}@${{ secrets.SSH_HOST }} "rm -rdf /home/${{ secrets.HOST_USER }}/runner/raid-callouts"
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
- name: deploy /w rsync to host
|
||||
run: |
|
||||
sudo rsync -avz $GITHUB_WORKSPACE ${{ secrets.HOST_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.HOST_USER }}/runner/
|
||||
|
||||
- name: build docker image on host + run it
|
||||
run: |
|
||||
ssh ${{ secrets.HOST_USER }}@${{ secrets.SSH_HOST }} "cd /home/${{ secrets.HOST_USER }}/runner/raid-callouts && docker compose up --build -d"
|
||||
|
||||
|
||||
54
.github/workflows/test.yaml
vendored
Normal file
54
.github/workflows/test.yaml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: "Test Helper Module"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- gabby-dev
|
||||
- josh-dev
|
||||
pull_request:
|
||||
types: [opened]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash -el {0}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.11.5]
|
||||
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@v4.1.1
|
||||
|
||||
- name: Set up conda /w python version 3.11.5
|
||||
uses: https://github.com/conda-incubator/setup-miniconda@v3.0.4
|
||||
with:
|
||||
miniconda-version: "latest"
|
||||
activate-environment: raid-callouts
|
||||
environment-file: environment.yml
|
||||
python-version: 3.11.5
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash -l {0}
|
||||
run: |
|
||||
conda env create --file environment.yml -n test-helper-module
|
||||
conda init
|
||||
conda activate test-helper-module
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: add database.ini
|
||||
shell: bash -l {0}
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/
|
||||
touch database.ini
|
||||
echo "${{ secrets.DATABASE_INI }}" >> xiv-database.ini
|
||||
|
||||
- name: Run tests
|
||||
shell: bash -l {0}
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE
|
||||
conda activate test-helper-module
|
||||
python -m pytest ./src/py/db_helper_tests.py
|
||||
Reference in New Issue
Block a user