Skip to content

Commit

Permalink
ci: initial GitHub actions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerdn authored Dec 16, 2024
1 parent fa6d855 commit 60c3354
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/actions/linux/action.yaml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
@@ -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/

0 comments on commit 60c3354

Please sign in to comment.