This repository was archived by the owner on May 26, 2025. It is now read-only.
WIP: Split compute controllers to cloud specific files #38
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| validate-python: | |
| name: Validate Python Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install mypy pyinstaller | |
| - name: Run mypy type checking | |
| run: | | |
| mypy src/mist/api | |
| - name: Compile Python files | |
| run: | | |
| find src/mist/api -name "*.py" -exec python -m py_compile {} \; | |
| - name: Try PyInstaller build | |
| run: | | |
| cd src/mist/api | |
| pyinstaller --onefile --clean --noconfirm --log-level DEBUG \ | |
| --hidden-import=mist.api.clouds.controllers.compute.base \ | |
| --hidden-import=mist.api.clouds.controllers.base \ | |
| --hidden-import=mist.api.concurrency.models \ | |
| --hidden-import=mist.api.tag.models \ | |
| clouds/controllers/compute/base.py | |
| build_mist_image: | |
| name: Build Mist Image | |
| needs: validate-python | |
| runs-on: ubuntu-latest | |
| env: | |
| GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
| steps: | |
| - name: Checkout repository with submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Log in to GitHub Container Registry | |
| run: echo "${GHCR_TOKEN}" | docker login ghcr.io -u "mistcommunity-bot" --password-stdin | |
| - name: Build Docker image | |
| run: | | |
| docker pull mist/python3 | |
| docker build --rm -t ghcr.io/${GITHUB_REPOSITORY_OWNER##*/}/mist:${GITHUB_SHA} \ | |
| --build-arg API_VERSION_SHA=${{ github.sha }} \ | |
| --build-arg API_VERSION_NAME=${{ github.ref_name }} . | |
| docker push ghcr.io/${GITHUB_REPOSITORY_OWNER##*/}/mist:${GITHUB_SHA} | |
| generate_api_spec: | |
| name: Generate API Spec | |
| runs-on: ubuntu-latest | |
| needs: build_mist_image | |
| container: | |
| image: ghcr.io/${{ github.repository_owner }}/mist:${{ github.sha }} | |
| steps: | |
| - name: Generate API Specification | |
| run: | | |
| cd /mist.api | |
| python3 openapi/generate_api_spec.py | |
| ls -l openapi | |
| # flake8: | |
| # name: Run Flake8 Lint | |
| # runs-on: ubuntu-latest | |
| # needs: generate_api_spec | |
| # container: | |
| # image: ghcr.io/${{ github.repository_owner }}/mist:${{ github.sha }} | |
| # steps: | |
| # - name: Run flake8 | |
| # run: | | |
| # cd /mist.api | |
| # flake8 --ignore=E402,E722,F632,F841,W504,W605 --exclude=v2,paramiko,lc | |
| uniq: | |
| name: Check Duplicate Migrations | |
| runs-on: ubuntu-latest | |
| needs: generate_api_spec | |
| container: | |
| image: ghcr.io/${{ github.repository_owner }}/mist:${{ github.sha }} | |
| steps: | |
| - name: Verify no duplicate migrations exist | |
| run: | | |
| cd /mist.api | |
| ls migrations/ | uniq -c -d -w 4 | grep . && exit 1 || exit 0 | |
| unit_tests: | |
| name: Run Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: generate_api_spec | |
| container: | |
| image: ghcr.io/${{ github.repository_owner }}/mist:${{ github.sha }} | |
| steps: | |
| - name: Execute unit tests | |
| run: | | |
| cd /mist.api | |
| python -m unittest discover tests/unit_tests/ -v |