Skip to content

adding pipeline stage files #49

adding pipeline stage files

adding pipeline stage files #49

Workflow file for this run

name: Deploy ADL LRS Application (Python)
'on':
push:
branches:
- ci-testing
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7"]
#python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install ruff pytest
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# - name: Lint with ruff
# run: |
# # stop the build if there are Python syntax errors or undefined names
# ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 .
# # default set of ruff rules with GitHub Annotations
# ruff --format=github --target-version=py37 .
# - name: Test with pytest
# run: |
# pytest
- name: Build and test
run: |
pip3 install -r requirements.txt
./test-lrs.sh
# deploy-dev:
# runs-on: ubuntu-latest
# environment: dev
# needs: build-and-test
# steps:
# - name: Configure SSH
# run: |
# mkdir -p ~/.ssh
# echo "${{ secrets.ADLNET_DEV_SSH_KEY }}" > ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa
# ssh-keyscan "${{ secrets.ADLNET_DEV_HOST }} >> ~/.ssh/known_hosts
# - name: Deploy code on Dev
# run: |
# ssh ${{ secrets.ADLNET_DEV_HOST_USER }}@${{ secrets.ADLNET_DEV_HOST }} "cd ${{ secrets.ADLNET_DEV_PROJECT_DIR }} && git pull origin ${GITHUB_REF#refs/heads/} && sudo docker-compose up -d --build"
deploy-staging:
runs-on: ubuntu-latest
environment: staging
needs:
- build-and-test
#- deploy-dev
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.ADLNET_STAGING_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan "${{ secrets.ADLNET_STAGING_HOST }}" >> ~/.ssh/known_hosts
- name: Deploy code on Staging
run: |
ssh ${{ secrets.ADLNET_STAGING_HOST_USER }}@${{ secrets.ADLNET_STAGING_HOST }} "
cd ${{ secrets.ADLNET_STAGING_PROJECT_DIR }} && \
echo 'Pulling Latest Code from Repository...' && \
git pull origin ${GITHUB_REF#refs/heads/} && \
echo 'Copying Required Config files...' && \
sudo cp /home/ubuntu/workflow/settings.ini /home/ubuntu/ADL_LRS/settings.ini && \
#sudo cp /home/ubuntu/workflow/docker/settings.ini /home/ubuntu/ADL_LRS/docker/lrs/settings.ini && \
sudo cp /home/ubuntu/workflow/.env /home/ubuntu/ADL_LRS/.env && \
echo 'Copying installing ssl certificate...' && \
sudo ./init-ssl.sh localhost && \
echo 'Rebuilding Docker Containers..' && \
sudo docker-compose stop && \
sudo docker-compose build --no-cache && \
sudo docker-compose up -d && \
echo 'deployed successfully on server'"