3.0.4 #143
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Open-Capture deployment | |
on: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
deploy-application: | |
name: Retrieve application | |
runs-on: self-hosted | |
defaults: | |
run: | |
working-directory: / | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Directory creation | |
run: | | |
sudo rm -rf /var/www/html/opencapture/ | |
sudo mkdir -p /var/www/html/opencapture/ | |
sudo chmod -R 775 /var/www/html/opencapture/ | |
sudo chown -R $(whoami):$(whoami) /var/www/html/opencapture/ | |
- name: Retrieve the latest tag | |
run: | | |
sudo apt install -y git crudini | |
git clone -b master https://github.com/edissyum/opencapture/ /var/www/html/opencapture/ | |
continue-on-error: true | |
deploy-frontend: | |
name: frontend deployment | |
runs-on: self-hosted | |
needs: [deploy-application] | |
defaults: | |
run: | |
working-directory: / | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install Node and npm | |
run: | | |
sudo apt install nodejs npm -y | |
continue-on-error: true | |
- name: Install dependencies | |
run: | | |
cd /var/www/html/opencapture/src/frontend/ | |
npm run reload-packages | |
- name: Build | |
run: | | |
cd /var/www/html/opencapture/src/frontend/ | |
npm run build-prod | |
deploy-backend: | |
name: backend deployment | |
runs-on: self-hosted | |
needs: [deploy-frontend] | |
defaults: | |
run: | |
working-directory: / | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Launch installation | |
run: | | |
cd var/www/html/opencapture/bin/install/ | |
chmod u+x install.sh | |
sed -i 's/$(tput bold)/""/gI' install.sh | |
sed -i 's/$(tput sgr0)/""/gI' install.sh | |
sudo su postgres -c "psql -c 'drop database opencapture_test'" | |
sudo ./install.sh --custom_id test --user $(whoami) --path /var/www/html/opencapture/ --wsgi_process 1 --wsgi_threads 5 --supervisor_systemd systemd --hostname $HOST_NAME --port $PORT --username $USER_NAME --password $USER_PASSWORD | |
env: | |
HOST_NAME: ${{ vars.HOST_NAME }} | |
PORT: ${{ vars.PORT }} | |
USER_NAME: ${{ vars.USER_NAME }} | |
USER_PASSWORD: ${{ vars.USER_PASSWORD }} | |
continue-on-error: true | |
- name: Service status | |
run: | | |
sudo systemctl status OCSplitter-worker_test.service | |
sudo systemctl status OCVerifier-worker_test.service | |
sudo systemctl start postgresql | |
sudo systemctl status postgresql | |
continue-on-error: true | |
- name: Launch backend tests | |
run: | | |
source /home/$(whoami)/python-venv/opencapture/bin/activate | |
cd /var/www/html/opencapture/ | |
python3 -m unittest discover src/backend/tests/ | |
sudo su postgres -c "psql -c 'drop database opencapture_test'" | |
sudo rm -rf /var/www/html/opencapture/ | |
sudo rm -rf /var/docservers/ | |
sudo rm -f /etc/apache2/sites-available/opencapture.conf | |
sudo rm -f /etc/systemd/system/OCVerifier-worker_test.conf | |
sudo rm -f /etc/systemd/system/OCSplitter-worker_test.conf | |
sudo systemctl daemon-reload | |
sudo systemctl restart apache2 |