From d7f74e4f68ec3fdb04ef7839711bb7655b96a77c Mon Sep 17 00:00:00 2001 From: sergerdn <64213648+sergerdn@users.noreply.github.com> Date: Mon, 9 Oct 2023 07:51:33 -0700 Subject: [PATCH] chore(dev-ops): add github actions --- .github/actions/linux/action.yaml | 44 ++++++++++++++++ .github/workflows/python-tests.yml | 85 ++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 .github/actions/linux/action.yaml create mode 100644 .github/workflows/python-tests.yml diff --git a/.github/actions/linux/action.yaml b/.github/actions/linux/action.yaml new file mode 100644 index 0000000..321c24f --- /dev/null +++ b/.github/actions/linux/action.yaml @@ -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 install --with-deps diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 0000000..8315023 --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,85 @@ +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 install --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 install --with-deps + + - name: Run tests with pytest + run: poetry run pytest -vv tests/