lint+refactor containers #1135
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: Tests | |
| on: push | |
| env: | |
| BOT_CREDENTIALS: example.ru@6d624b45b67f843322ebaa1143132a24@7a1c7744-23c9-4ba9-a7dc-5381f090a52d | |
| REDIS_DSN: redis://localhost:6379/0 | |
| POSTGRES_DSN: postgresql://postgres:postgres@localhost:5432/postgres | |
| SMARTLOG_DEBUG_HUIDS: 7d8eac87-8fc8-452c-9d57-34f988475368 | |
| poetry_version: "1.5.0" | |
| project_name: "bot-example" | |
| PROD_SERVER_HOST: "prod.example.com" | |
| DEV_SERVER_HOST: "dev.example.com" | |
| BOTS_REGISTRY_URL: "registry.example.com/bots/" | |
| jobs: | |
| test-image: | |
| name: Test app start | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Install copier | |
| run: | | |
| pip install copier==9.4.0 | |
| pip install copier-templates-extensions==0.3.1 | |
| - name: Test image | |
| env: | |
| REDIS_DSN: ${{ env.REDIS_DSN }} | |
| POSTGRES_DSN: ${{ env.POSTGRES_DSN }} | |
| run: ./.github/scripts/test_image | |
| test-template: | |
| name: Test template | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| python-version: [ "3.8", "3.9", "3.10", "3.11"] | |
| services: | |
| postgres: | |
| image: postgres:12 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:6 | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Install copier | |
| run: | | |
| pip install copier==9.4.0 | |
| pip install copier-templates-extensions==0.3.1 | |
| python -m copier copy --trust --force . bot-example | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Get full Python version | |
| id: full-python-version | |
| run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") | |
| - name: Set up cache | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ${{ env.project_name }}/.venv | |
| key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| working-directory: ${{ env.project_name }} | |
| run: | | |
| pip install poetry==${{ env.poetry_version }} | |
| poetry config virtualenvs.in-project true | |
| poetry install | |
| - name: Run tests | |
| env: | |
| BOT_CREDENTIALS: example.ru@6d624b45b67f843322ebaa1143132a24@7a1c7744-23c9-4ba9-a7dc-5381f090a52d | |
| REDIS_DSN: redis://localhost:6379/0 | |
| POSTGRES_DSN: postgresql://postgres:postgres@localhost:5432/postgres | |
| working-directory: ${{ env.project_name }} | |
| run: | | |
| poetry run ./scripts/test | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Install copier | |
| run: | | |
| pip install copier==9.4.0 | |
| pip install copier-templates-extensions==0.3.1 | |
| python -m copier copy --trust --force . bot-example | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Get full Python version | |
| id: full-python-version | |
| run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") | |
| - name: Set up cache | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ${{ env.project_name }}/.venv | |
| key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| working-directory: ${{ env.project_name }} | |
| run: | | |
| pip install poetry==${{ env.poetry_version }} | |
| poetry config virtualenvs.in-project true | |
| poetry install | |
| - name: Run linters | |
| working-directory: ${{ env.project_name }} | |
| run: | | |
| poetry run ./scripts/lint |