changed the machine type in cicd configuration #2
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: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| env: | |
| APP_NAME: ${{ github.event.repository.name }} | |
| PYTHON_VERSION: "3.12.6" | |
| POETRY_VERSION: "1.8.3" | |
| VIRTUAL_ENV: .venv | |
| jobs: | |
| dependencies: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| # Install build dependencies | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential gcc g++ make | |
| # Configure Git for private repo access | |
| - name: Configure Git | |
| run: | | |
| git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache venv | |
| id: cache-venv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-venv-${{ github.ref_name }}-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-venv-${{ github.ref_name }}- | |
| - name: Install dependencies | |
| run: | | |
| python -m venv ${{ env.VIRTUAL_ENV }} | |
| ${{ env.VIRTUAL_ENV }}/bin/pip install --upgrade pip wheel poetry==${{ env.POETRY_VERSION }} | |
| ${{ env.VIRTUAL_ENV }}/bin/poetry check --lock | |
| ${{ env.VIRTUAL_ENV }}/bin/poetry install | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Save poetry dist | |
| if: always() | |
| run: echo "Dependencies installed." | |
| lint: | |
| needs: dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| # Add make installation | |
| - name: Install make | |
| run: sudo apt-get update && sudo apt-get install -y make | |
| - name: Restore venv from cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-venv-${{ github.ref_name }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Run linting | |
| run: | | |
| export PATH=${{ env.VIRTUAL_ENV }}/bin:$PATH | |
| make lint | |
| # Uncomment if you want to use mypy | |
| # mypy: | |
| # needs: dependencies | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # | |
| # - name: Set up Python | |
| # uses: actions/setup-python@v4 | |
| # with: | |
| # python-version: ${{ env.PYTHON_VERSION }} | |
| # | |
| # # Add make installation | |
| # - name: Install make | |
| # run: sudo apt-get update && sudo apt-get install -y make | |
| # | |
| # - name: Restore venv from cache | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: .venv | |
| # key: ${{ runner.os }}-venv-${{ github.ref_name }}-${{ hashFiles('**/poetry.lock') }} | |
| # | |
| # - name: Run mypy | |
| # run: | | |
| # export PATH=${{ env.VIRTUAL_ENV }}/bin:$PATH | |
| # make mypy | |
| test: | |
| needs: dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| # Add make installation | |
| - name: Install make | |
| run: sudo apt-get update && sudo apt-get install -y make | |
| - name: Restore venv from cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-venv-${{ github.ref_name }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Run tests | |
| run: | | |
| export PATH=${{ env.VIRTUAL_ENV }}/bin:$PATH | |
| make test | |
| build_test: | |
| needs: [lint, test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| # Add make installation if your build process uses make | |
| - name: Install make | |
| run: sudo apt-get update && sudo apt-get install -y make | |
| - name: Restore venv from cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-venv-${{ github.ref_name }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Build and test | |
| run: | | |
| export PATH=${{ env.VIRTUAL_ENV }}/bin:$PATH | |
| poetry build | |
| pip install dist/*.whl | |
| python examples/example.py | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ |