Skip to content

Commit

Permalink
cache
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed May 23, 2024
1 parent 7eb2921 commit c1a8ba3
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 38 deletions.
84 changes: 61 additions & 23 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,25 @@ jobs:
python-version: '3.11'

- name: Install Poetry
run: pip install poetry
run: pipx install poetry

- name: Generate hash of req dependencies
id: cq
- name: Generate hash of lint dependencies only
run: |
poetry export --only=lint --format=requirements.txt --output=requirements.txt
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
id: cql
with:
path: |
~/.cache/pypoetry
~/.cache/pip
key: ${{ runner.os }}-poetry-${{ env.hash }}
key: ${{ runner.os }}-lint-${{ env.hash }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Echo env
run: poetry env info
${{ runner.os }}-lint-
- name: Install lint dependencies
if: steps.cql.outputs.cache-hit == 'false'
run: poetry install --only=lint --no-interaction --no-root

- name: Check code quality
Expand All @@ -56,17 +53,31 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
id: cq
with:
python-version: '3.11'
cache: 'poetry'

- name: Install poetry
run: pipx install poetry

- name: Generate hash of lint dependencies only
run: |
poetry export --only=lint --format=requirements.txt --output=requirements.txt
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
id: cqf
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-lint-${{ env.hash }}
restore-keys: |
${{ runner.os }}-lint-
- name: Install lint dependencies
if: steps.cqf.outputs.cache-hit == 'false'
run: poetry install --only=lint --no-interaction --no-root

- name: Check code style
Expand All @@ -79,15 +90,28 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
run: pipx install poetry

- name: Set up python
- name: Generate hash of types dependencies only
run: |
poetry export --only=types --format=requirements.txt --output=requirements.txt
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
id: cqtc
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'poetry'
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-types-${{ env.hash }}
restore-keys: |
${{ runner.os }}-types-
- name: Install types and mypy dependencies
run: poetry install --only=types --no-interaction --no-root
Expand All @@ -102,17 +126,31 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
id: cq
with:
python-version: '3.11'
cache: 'poetry'

- name: Install poetry
run: pipx install poetry

- name: Generate hash of lint dependencies only
run: |
poetry export --only=lint --format=requirements.txt --output=requirements.txt
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
id: cqsc
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-lint-${{ env.hash }}
restore-keys: |
${{ runner.os }}-lint-
- name: Install lint dependencies
if: steps.cqsc.outputs.cache-hit == 'false'
run: poetry install --only=lint --no-interaction --no-root

- name: Check spellings
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/code_test_unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,31 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
id: ct
with:
python-version: '3.11'
cache: 'poetry'

- name: Install poetry
run: pipx install poetry

- name: Generate hash of tesk with test dependencies only
run: |
poetry export --with=lint --format=requirements.txt --output=requirements.txt
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
id: ctuut
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-test-${{ env.hash }}
restore-keys: |
${{ runner.os }}-test-
- name: Install test dependencies
if: steps.ctuut.outputs.cache-hit == 'false'
run: poetry install --only=test --no-interaction

- name: Run tests and generate coverage as test_unit.xml
Expand Down
48 changes: 38 additions & 10 deletions .github/workflows/vulnerabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,31 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up python
id: vt
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'poetry'

- name: Install poetry
run: pipx install poetry

- name: Generate hash of security dependencies only
run: |
poetry export --only=security --format=requirements.txt --output=requirements.txt
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
id: vcv
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-security-${{ env.hash }}
restore-keys: |
${{ runner.os }}-security-
- name: Install vulnerabilities check dependencies
if: steps.vcv.outputs.cache-hit == 'false'
run: poetry install --only=security --no-interaction --no-root

- name: Check code vulnerabilities with bandit
Expand All @@ -39,17 +53,31 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up python
id: vt
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'poetry'

- name: Install poetry
run: pipx install poetry

- name: Generate hash of security dependencies only
run: |
poetry export --only=security --format=requirements.txt --output=requirements.txt
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
id: vdv
with:
path: |
~/.cache/pypoetry
key: ${{ runner.os }}-security-${{ env.hash }}
restore-keys: |
${{ runner.os }}-security-
- name: Install vulnerabilities check dependencies
if: steps.vdv.outputs.cache-hit == 'false'
run: poetry install --only=security --no-interaction --no-root

- name: Check dependency vulnerabilities with safety
Expand Down

0 comments on commit c1a8ba3

Please sign in to comment.