Skip to content

Commit

Permalink
ci: continue working on workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
natelandau committed Nov 3, 2023
1 parent 360bcf2 commit fa62301
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 60 deletions.
60 changes: 25 additions & 35 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,36 @@ outputs:
runs:
using: composite
steps:
- name: Get pipx env vars
id: pipx-env-vars
shell: bash
run: |
echo "pipx-home=${PIPX_HOME}" >> $GITHUB_OUTPUT
echo "pipx-bin-dir=${PIPX_BIN_DIR}" >> $GITHUB_OUTPUT
# ----------------------------------------------
# Install python and checkout repository
# ----------------------------------------------

- name: Load pipx cache
# If env vars are not defined do not load cache
if: >
steps.pipx-env-vars.outputs.pipx-home != ''
&& steps.pipx-env-vars.outputs.pipx-bin-dir != ''
id: pipx-cache
uses: actions/cache@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
path: |
${{ steps.pipx-env-vars.outputs.pipx-home }}/venvs/poetry
${{ steps.pipx-env-vars.outputs.pipx-bin-dir }}/poetry
key: ${{ runner.os }}-${{ inputs.python-version }}-pipx-${{ hashFiles('**/poetry.lock') }}
python-version: ${{ matrix.python-version }}

- name: Install poetry
# If env vars are not defined or we missed pipx cache, install poetry
if: >
(
steps.pipx-env-vars.outputs.pipx-home == ''
&& steps.pipx-env-vars.outputs.pipx-bin-dir == ''
)
|| steps.pipx-cache.outputs.cache-hit != 'true'
shell: bash
run: pipx install poetry
# ----------------------------------------------
# Install poetry and project dependencies
# ----------------------------------------------
# poetry config installer.max-workers 1
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Load poetry cache
uses: actions/setup-python@v4
id: setup-python
# Load cached venv if cache exists
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
python-version: ${{ inputs.python-version }}
cache: poetry
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install poetry dependencies
# If we missed poetry cache install dependencies
if: steps.setup-python.outputs.cache-hit != 'true'
# Install dependencies if cache does not exist
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
shell: bash
run: poetry install --all-extras
29 changes: 7 additions & 22 deletions .github/workflows/automated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,25 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12"]
python-version: ["3.11"]
steps:
- name: Harden Security Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
egress-policy: block
disable-sudo: true
allowed-endpoints: >
api.github.com:443
api.snapcraft.io:443
auth.docker.io:443
codecov.io:443
files.pythonhosted.org:443
github.com:443
install.python-poetry.org:443
production.cloudflare.docker.com:443
pypi.org:443
python-poetry.org:443
randomuser.me:443
registry-1.docker.io:443
storage.googleapis.com:443
uploader.codecov.io:443
Expand Down Expand Up @@ -84,26 +86,9 @@ jobs:
# ----------------------------------------------
# Install poetry and project dependencies
# ----------------------------------------------
# poetry config installer.max-workers 1
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

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

# Install dependencies if cache does not exist
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --all-extras
- name: Setup Python and Poetry
uses: ./.github/actions/setup-poetry

# ----------------------------------------------
# run linters
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

[tool.poetry.dependencies]
aiofiles = "^23.2.1"
aiohttp = "^3.8.6"
arrow = "^1.3.0"
beanie = "^1.23.1"
boto3 = "^1.28.76"
Expand Down

0 comments on commit fa62301

Please sign in to comment.