diff --git a/.github/actions/linux/action.yaml b/.github/actions/linux/action.yaml new file mode 100644 index 0000000..e765adf --- /dev/null +++ b/.github/actions/linux/action.yaml @@ -0,0 +1,72 @@ +name: 'Setup Python, Poetry, and Playwright' +description: 'Set up Python, install Poetry, cache dependencies, install Playwright, and install all dependencies with Poetry.' + +inputs: + python-version: + description: 'Version of Python to use.' + required: true + default: '3.12' + gh-organization-token: + description: 'GitHub Access Token with access to the organization’s repositories for authentication and dependency management.' + required: true + +runs: + using: 'composite' + steps: + - name: Checkout LFS objects + shell: bash + run: git lfs checkout + + - name: Set up Python ${{ inputs.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Cache Python dependencies + uses: actions/cache@v4 + id: poetry-cache + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Verify Python and Poetry installation + shell: bash + run: | + python --version + poetry --version + + - name: Install dependencies with Poetry + shell: bash + run: | + poetry config experimental.system-git-client true --local + poetry install --no-interaction --no-root + + - name: Get installed Playwright version + id: playwright-version + shell: bash + run: | + PLAYWRIGHT_VERSION=$(poetry show playwright | grep "version" | awk '{print $3}') + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> "$GITHUB_ENV" + + - name: Cache Playwright dependencies + uses: actions/cache@v4 + id: playwright-cache + with: + path: ~/.cache/ms-playwright/ + key: playwright-${{ runner.os }}-${{ env.PLAYWRIGHT_VERSION }} + + - name: Install Playwright dependencies with Poetry + shell: bash + run: poetry run playwright install chromium --with-deps + + - name: Verify Playwright installation + shell: bash + run: | + poetry run playwright -V diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6e8bf4d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + + +version: 2 +updates: + # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem + - package-ecosystem: pip # poetry package manager wil be used + directory: "/" + # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#scheduleinterval + schedule: + interval: daily + open-pull-requests-limit: 10 + versioning-strategy: increase diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml new file mode 100644 index 0000000..442fec4 --- /dev/null +++ b/.github/workflows/ci_linux.yml @@ -0,0 +1,42 @@ +name: Linux Python CI + +on: + push: + branches: + - develop + - master + tags: + - '*' + pull_request: + branches: + - develop + - master + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true + APP_ENVIRONMENT: "test" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read +jobs: + linux_lint: + runs-on: ubuntu-24.04 # https://github.com/actions/runner-images#available-images + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + lfs: true + + - name: Setup Python and Poetry + uses: ./.github/actions/linux + with: + python-version: '3.12' + + - name: Lint with mypy and flake8 + run: | + poetry run mypy ozon_collector/ + poetry run flake8 ozon_collector/