Skip to content

ci(CI/CD): 💚 Added CI/CD to testing #181

ci(CI/CD): 💚 Added CI/CD to testing

ci(CI/CD): 💚 Added CI/CD to testing #181

Workflow file for this run

name: Python lint and CI/CD
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: isort/isort-action@master
with:
sortPaths: "./menuflow"
- uses: psf/black@stable
with:
src: "./menuflow"
version: "22.3.0"
- name: pre-commit
run: |
pip install pre-commit
pre-commit run -av trailing-whitespace
pre-commit run -av end-of-file-fixer
pre-commit run -av check-yaml
pre-commit run -av check-added-large-files
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.*') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Run pytest
run: |
pytest -vv
docker:
if: "github.ref_name == 'main'"
runs-on: ubuntu-latest
needs: [lint, test]
environment: deploy
steps:
- name: Checkout code
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ variables.MENUFLOW_IMAGE }}

Check failure on line 77 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / Python lint and CI/CD

Invalid workflow file

The workflow is not valid. .github/workflows/main.yml (Line: 77, Col: 17): Unrecognized named-value: 'variables'. Located at position 1 within expression: variables.MENUFLOW_IMAGE
-
name: Run Bash script
# Download updated docker image to testing server
run: |
echo "** Download updated docker image **"
ssh -tt $secrets.HOST_TESTING "docker pull $variables.MENUFLOW_IMAGE"
echo "** Update menuflow image in registered domains **"
for domain in ${variables.DOMAINS}; do
echo " >> Setting service variables"
stack_name=$(echo ${domain} | tr -d '.')
service=$(echo ${domain} | cut -d '.' -f1)
menuflow_service="${stack_name}_${service}-menuflow"
echo " >> Remove the service if exists"
ssh -tt $secrets.HOST_TESTING " \
if docker service ps ${menuflow_service}; then \
docker service rm ${menuflow_service}; \
else \
echo 'The service ${menuflow_service} is not exists'; \
fi;
"
echo " >> Deploy the service"
docker_compose_file="/mnt/shared/matrix/${domain}/docker-compose.yml"
ssh -tt $secrets.HOST_TESTING " \
docker-compose -f ${docker_compose_file} config | \
docker stack deploy -c - ${stack_name};
"
done