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/