Merge pull request #606 from kikeelectronico/dependabot/npm_and_yarn/… #146
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: Build on dev changes | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- dev | |
paths: | |
- 'back/**' | |
- 'configuration_templates/**' | |
- 'docker/**' | |
- 'front/**' | |
env: | |
REDIS_VERSION: 6 | |
PYTHON_VERSION: 3.8 | |
MOSQUITTO_VERSION: 2.0 | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
unit_test_backend: | |
name: Unit testing backend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Start Redis ${{env.REDIS_VERSION}} | |
uses: supercharge/[email protected] | |
with: | |
redis-version: ${{env.REDIS_VERSION}} | |
- name: Start Mosquitto broker ${{env.MOSQUITTO_VERSION}} | |
uses: Namoshek/mosquitto-github-action@v1 | |
with: | |
version: ${{env.MOSQUITTO_VERSION}} | |
ports: '1883:1883' | |
- name: Set up Python ${{env.PYTHON_VERSION}} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{env.PYTHON_VERSION}} | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
working-directory: ./back | |
- name: Test | |
run: python -m unittest discover | |
working-directory: ./back | |
build_and_push_backend: | |
name: Build and push backend | |
runs-on: ubuntu-latest | |
needs: unit_test_backend | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Build and push BE | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./docker/Dockerfile-back | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/homewarelan-back:dev | |
build_push_frontend: | |
name: Build and push frontend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Build and push FE | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./docker/Dockerfile-nginx | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/homewarelan-nginx:dev |