83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
name: Add new service
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'feature/add-service-*'
|
|
|
|
env:
|
|
UV_CACHE_DIR: /var/cache/uv
|
|
UV_LINK_MODE: hardlink
|
|
|
|
# TODO: when to deploy to prod? Manual (i.e. the 'Ioc' workflow)?
|
|
jobs:
|
|
deploy:
|
|
runs-on: hla-dev
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run cli tests
|
|
run: |
|
|
echo $UV_CACHE_DIR
|
|
uv run --directory cli pytest
|
|
|
|
- name: Parse Service Directory Name
|
|
id: parse_branch
|
|
# Uses bash shell parameter elimination to strip 'feature/add-service-' from the front
|
|
run: |
|
|
BRANCH="${{ github.ref_name }}"
|
|
SERVICE_NAME="${BRANCH#feature/add-service-}"
|
|
echo "service_name_lower=$SERVICE_NAME" >> $GITHUB_OUTPUT
|
|
|
|
- name: Qt - deploy
|
|
env:
|
|
DEST_DIR: /sls/bd/hla/dev/qt
|
|
run: |
|
|
mkdir -p "${DEST_DIR}"
|
|
|
|
rsync -avz --delete \
|
|
--exclude='.nfs*' \
|
|
--exclude='.git/' \
|
|
--exclude='.venv/' \
|
|
--exclude='__pycache__/' \
|
|
--exclude='*.pyc' \
|
|
--exclude='.pytest_cache/' \
|
|
./qt/* "${DEST_DIR}/"
|
|
|
|
### SUBSTITUTIONS
|
|
source "${{ github.workspace }}/.gitea/scripts/common.sh"
|
|
set_env_suffix "dev"
|
|
sed -i "s/{{ *agebd_env_suffix_upper* }}/${AGEBD_ENV_SUFFIX_UPPER}/g" "${DEST_DIR}/"*
|
|
sed -i "s/{{ *agebd_env_suffix_lower* }}/${AGEBD_ENV_SUFFIX_LOWER}/g" "${DEST_DIR}/"*
|
|
|
|
# The ioc steps read the deployed ioc files on /sls, so the service
|
|
# has to be deployed before its ioc is installed.
|
|
- name: Deploy and Restart Master Service
|
|
run: |
|
|
./.gitea/scripts/deploy-service.sh "master" "dev" true
|
|
|
|
- name: Install Master IOC
|
|
run: |
|
|
./.gitea/scripts/ioc-install.sh "master" "dev"
|
|
|
|
- name: Restart Master IOC
|
|
run: |
|
|
./.gitea/scripts/ioc-restart.sh "master" "dev"
|
|
|
|
- name: Deploy and Restart New Service
|
|
run: |
|
|
SERVICE_NAME=${{ steps.parse_branch.outputs.service_name_lower }}
|
|
./.gitea/scripts/deploy-service.sh "${SERVICE_NAME}" "dev" true
|
|
|
|
- name: Install New IOC
|
|
run: |
|
|
SERVICE_NAME=${{ steps.parse_branch.outputs.service_name_lower }}
|
|
./.gitea/scripts/ioc-install.sh "${SERVICE_NAME}" "dev"
|
|
|
|
- name: Start New IOC
|
|
run: |
|
|
SERVICE_NAME=${{ steps.parse_branch.outputs.service_name_lower }}
|
|
./.gitea/scripts/ioc-start.sh "${SERVICE_NAME}" "dev"
|