Skip to content

Commit

Permalink
refactor(workflows): use a workflow-level env var to define path to b…
Browse files Browse the repository at this point in the history
…uild requirements file

Signed-off-by: Diogo Teles Sant'Anna <[email protected]>
  • Loading branch information
diogoteles08 committed Jul 10, 2023
1 parent 0e1db7d commit 916a9bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
workflows: ["Wheel Builder"]
types: [completed]

env:
PUBLISH_REQUIREMENTS_PATH: .github/workflows/requirements/publish-requirements.txt

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -29,13 +32,12 @@ jobs:
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
sparse-checkout: |
.github/workflows/requirements/publish-requirements.txt
$PUBLISH_REQUIREMENTS_PATH
sparse-checkout-cone-mode: false
ref: ${{ github.ref }}
persist-credentials: false
- run: mv .github/workflows/requirements/publish-requirements.txt .
- name: Install Python dependencies
run: pip install --require-hashes -r publish-requirements.txt
run: pip install --require-hashes -r $PUBLISH_REQUIREMENTS_PATH

- uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
with:
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
- pyproject.toml
- vectors/pyproject.toml

env:
BUILD_REQUIREMENTS_PATH: .github/workflows/requirements/build-requirements.txt

jobs:
sdist:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -111,13 +114,11 @@ jobs:
ref: ${{ github.event.inputs.version || github.ref }}
persist-credentials: false
sparse-checkout: |
.github/workflows/requirements/build-requirements.txt
$BUILD_REQUIREMENTS_PATH
sparse-checkout-cone-mode: false
- run: mv .github/workflows/requirements/build-requirements.txt .

- run: /opt/python/${{ matrix.PYTHON.VERSION }}/bin/python -m venv .venv
- name: Install Python dependencies
run: .venv/bin/pip install --require-hashes -r build-requirements.txt
run: .venv/bin/pip install --require-hashes -r $BUILD_REQUIREMENTS_PATH

- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
Expand Down Expand Up @@ -206,10 +207,8 @@ jobs:
ref: ${{ github.event.inputs.version || github.ref }}
persist-credentials: false
sparse-checkout: |
.github/workflows/requirements/build-requirements.txt
$BUILD_REQUIREMENTS_PATH
sparse-checkout-cone-mode: false
- run: mv .github/workflows/requirements/build-requirements.txt .

- name: Setup python
run: |
curl "$PYTHON_DOWNLOAD_URL" -o python.pkg
Expand Down Expand Up @@ -238,7 +237,7 @@ jobs:
target: aarch64-apple-darwin
- run: ${{ matrix.PYTHON.BIN_PATH }} -m venv venv
- name: Install Python dependencies
run: venv/bin/pip install --require-hashes -r build-requirements.txt
run: venv/bin/pip install --require-hashes -r $BUILD_REQUIREMENTS_PATH

- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
Expand Down Expand Up @@ -304,9 +303,8 @@ jobs:
ref: ${{ github.event.inputs.version || github.ref }}
persist-credentials: false
sparse-checkout: |
.github/workflows/requirements/build-requirements.txt
$BUILD_REQUIREMENTS_PATH
sparse-checkout-cone-mode: false
- run: mv .github/workflows/requirements/build-requirements.txt .

- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
Expand Down Expand Up @@ -337,7 +335,7 @@ jobs:
echo "OPENSSL_STATIC=1" >> $GITHUB_ENV
shell: bash
- name: Install Python dependencies
run: python -m pip install --require-hashes -r build-requirements.txt
run: python -m pip install --require-hashes -r $BUILD_REQUIREMENTS_PATH
- run: mkdir wheelhouse
- run: |
if [ -n "${{ matrix.PYTHON.ABI_VERSION }}" ]; then
Expand Down

0 comments on commit 916a9bc

Please sign in to comment.