Skip to content

Commit

Permalink
chore(dev-ops): add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerdn committed Oct 9, 2023
1 parent 5a11117 commit 9a04bae
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/actions/linux/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Setup Python and Poetry.'
description: 'Set up Python, install Poetry, cache dependencies, and install them with Poetry.'

inputs:
python-version:
description: 'Version of Python to use.'
required: true
default: '3.11'

runs:
using: 'composite'
steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Checkout LFS objects
shell: bash
run: git lfs checkout

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
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 dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies with Poetry
shell: bash
run: |
mkdir ./dist && touch ./dist/README.md
poetry install --no-interaction
poetry run playwright chromium --with-deps
87 changes: 87 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Python CI

on:
push:
branches: [ "develop", "master" ]
pull_request:
branches: [ "develop", "master" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-22.04 # https://github.com/actions/runner-images#available-images

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Checkout LFS objects
run: git lfs checkout

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Cache dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies with Poetry
run: |
mkdir ./dist && touch ./dist/README.md
poetry install --no-interaction --with dev,cmd,cmd-dev,docs
poetry run playwright chromium --with-deps
test:
needs: build
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Checkout LFS objects
run: git lfs checkout

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Cache dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies with Poetry
run: |
mkdir ./dist && touch ./dist/README.md
poetry install --no-interaction --with dev,cmd,cmd-dev,docs
poetry run playwright chromium --with-deps
- name: Run tests with pytest
env:
FINGERPRINT_KEY: ${{ secrets.FINGERPRINT_KEY }}
run: poetry run pytest -vv tests/

0 comments on commit 9a04bae

Please sign in to comment.