Update certstream #207
This file contains hidden or 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: Docker Image Test | |
| on: | |
| push: | |
| paths: | |
| - 'Watcher/**' | |
| branches: [ test ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0.42 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: db_watcher | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| working-directory: ./Watcher/ | |
| run: | | |
| sudo apt update && sudo apt install -y libsasl2-dev python3-dev libldap2-dev libssl-dev default-libmysqlclient-dev & | |
| echo "127.0.0.1 db_watcher" | sudo tee -a /etc/hosts | |
| wait | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install --extra-index-url https://download.pytorch.org/whl/cpu torch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 | |
| npm install & | |
| wait | |
| - name: Run back-end tests | |
| working-directory: ./Watcher/Watcher | |
| run: python manage.py test | |
| env: | |
| DB_USER: root | |
| DB_PASSWORD: root | |
| - name: Run front-end tests | |
| working-directory: ./Watcher/Watcher | |
| run: | | |
| python manage.py migrate | |
| python manage.py shell -c " | |
| from django.contrib.auth.models import User | |
| User.objects.create_superuser('Watcher', 'cypress@watcher.com', 'Watcher') | |
| " | |
| python manage.py runserver 127.0.0.1:8000 & | |
| sleep 10 | |
| timeout 60 bash -c 'until curl -f http://127.0.0.1:8000; do sleep 2; done' | |
| npm run cypress:run | |
| env: | |
| DB_USER: root | |
| DB_PASSWORD: root | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # ================================= | |
| # GITHUB CONTAINER REGISTRY (GHCR) | |
| # ================================= | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for GHCR (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/thalesgroup-cert/watcher | |
| tags: | | |
| type=raw,value=test | |
| - name: Build and push to GHCR | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./Watcher | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # ============================================================ | |
| # DOCKER HUB - Legacy registry (DEPRECATED) | |
| # ⚠️ Docker Hub support will end on February 28, 2026 | |
| # Please migrate to GitHub Container Registry (ghcr.io) before this date | |
| # ============================================================ | |
| - name: Login to DockerHub (DEPRECATED) | |
| uses: docker/login-action@v3 | |
| continue-on-error: true | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push to Docker Hub (DEPRECATED) | |
| uses: docker/build-push-action@v5 | |
| continue-on-error: true | |
| with: | |
| context: ./Watcher | |
| push: true | |
| tags: felix83000/watcher:test | |
| labels: ${{ steps.meta.outputs.labels }} |