mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
commit
9388e2dc88
51
.github/workflows/deploy.yml
vendored
51
.github/workflows/deploy.yml
vendored
@ -1,21 +1,46 @@
|
||||
name: Deploy to production
|
||||
concurrency: production
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Unit Testing]
|
||||
types: [completed]
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
on-success:
|
||||
deployment:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
environment: production
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- run: echo 'The triggering workflow passed'
|
||||
- name: SSH Remote Commands
|
||||
uses: appleboy/ssh-action@dce9d565de8d876c11d93fa4fe677c0285a66d78
|
||||
with:
|
||||
# Proxy
|
||||
proxy_host : ${{secrets.PROXY_HOST}}
|
||||
proxy_port : ${{secrets.PROXY_PORT}}
|
||||
proxy_username : ${{secrets.PROXY_USER}}
|
||||
proxy_passphrase: ${{secrets.PROXY_PASSPHRASE}}
|
||||
proxy_key: ${{secrets.PROXY_KEY}}
|
||||
|
||||
# Serveur web
|
||||
host: ${{secrets.HOST}}
|
||||
port : ${{secrets.PORT}}
|
||||
username : ${{secrets.USER}}
|
||||
key: ${{secrets.KEY}}
|
||||
|
||||
on-failure:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||
steps:
|
||||
- run: echo 'The triggering workflow failed'
|
||||
# See https://github.com/ae-utbm/sith3/wiki/GitHub-Actions#deployment-action
|
||||
script: |
|
||||
BASE_DIR="$(dirname "$(realpath "$0")")"
|
||||
export PATH="$HOME/.poetry/bin:$PATH"
|
||||
pushd $BASE_DIR
|
||||
|
||||
VERSION_LAST=$(git rev-parse HEAD)
|
||||
git pull
|
||||
poetry update
|
||||
poetry run ./manage.py migrate
|
||||
echo "yes" | poetry run ./manage.py collectstatic
|
||||
poetry run ./manage.py compilestatic
|
||||
poetry run ./manage.py compilemessages
|
||||
|
||||
sudo systemctl restart uwsgi
|
63
.github/workflows/unittests.bak
vendored
63
.github/workflows/unittests.bak
vendored
@ -1,63 +0,0 @@
|
||||
name: Unit Testing
|
||||
|
||||
on: [push]
|
||||
jobs:
|
||||
unittests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gettext libxapian-dev libgraphviz-dev
|
||||
|
||||
- name: Install poetry
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install poetry
|
||||
|
||||
- name: Checking pyproject.toml syntax
|
||||
run: poetry check
|
||||
|
||||
- name: Install project
|
||||
run: poetry install -E testing
|
||||
|
||||
- name: Setup xapian index
|
||||
run: |
|
||||
mkdir -p /dev/shm/search_indexes
|
||||
ln -s /dev/shm/search_indexes sith/search_indexes
|
||||
|
||||
- name: Setup project
|
||||
run: poetry run ./manage.py compilemessages
|
||||
|
||||
- name: Launch tests and generate coverage report
|
||||
run: |
|
||||
poetry run coverage run ./manage.py test
|
||||
poetry run coverage report
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Install black
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install black==22.6.0
|
||||
|
||||
- name: Check linting
|
||||
run: black --check .
|
||||
|
||||
|
58
.github/workflows/unittests.yml
vendored
58
.github/workflows/unittests.yml
vendored
@ -1,17 +1,69 @@
|
||||
name: Unit Testing
|
||||
|
||||
on: [push]
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
unittests:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- run: echo 'Dry test'
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gettext libxapian-dev libgraphviz-dev
|
||||
|
||||
- name: Install poetry
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install poetry
|
||||
|
||||
- name: Checking pyproject.toml syntax
|
||||
run: poetry check
|
||||
|
||||
- name: Install project
|
||||
run: poetry install -E testing
|
||||
|
||||
- name: Setup xapian index
|
||||
run: |
|
||||
mkdir -p /dev/shm/search_indexes
|
||||
ln -s /dev/shm/search_indexes sith/search_indexes
|
||||
|
||||
- name: Setup project
|
||||
run: poetry run ./manage.py compilemessages
|
||||
|
||||
- name: Launch tests and generate coverage report
|
||||
run: |
|
||||
poetry run coverage run ./manage.py test
|
||||
poetry run coverage report
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- run: echo 'Dry lint'
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Install black
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install black==22.6.0
|
||||
|
||||
- name: Check linting
|
||||
run: black --check .
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user