Skip to content

Commit

Permalink
Use absolute paths when referencing files in GHA (#63)
Browse files Browse the repository at this point in the history
* Use absolute paths when referencing files in GHA
* Add 'raw' tags to avoid Cookiecutter interpreting tags

---------

Co-authored-by: Arne Sørli <[email protected]>
  • Loading branch information
mallport and arneso-ssb authored Apr 5, 2024
1 parent b427b1e commit fdb18a9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
with:
python-version: "3.12"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt pip
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox
- name: Build documentation
run: nox --force-color --session=docs
- name: Upload artifact
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
with:
python-version: "3.12"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt pre-commit
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt pip
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt pre-commit
- name: Compute cache key prefix
if: matrix.os != 'windows-latest'
id: cache_key_prefix
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install tools using pip
working-directory: ssb-pypitemplate
working-directory: ${{ github.workspace }}/ssb-pypitemplate
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pipx install --pip-args=--constraint=.github/workflows/constraints.txt cookiecutter
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
pipx install --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt cookiecutter
pipx install --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt nox nox-poetry
pipx install --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt poetry
- name: Generate project using Cookiecutter
run: cookiecutter --no-input ssb-pypitemplate project_name=ssb-library
run: |
cookiecutter --no-input ssb-pypitemplate project_name=ssb-library
- name: Create poetry.lock file
run: poetry update --lock
working-directory: ssb-library
Expand Down Expand Up @@ -98,8 +99,8 @@ jobs:
with:
python-version: "3.12"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt pip
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox
- name: Build documentation
run: nox --force-color --session=docs
- name: Check links
Expand Down
5 changes: 3 additions & 2 deletions {{cookiecutter.project_name}}/.github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ jobs:
steps:
- name: Check out the repository
uses: actions/checkout@v4

{% raw %}
- name: Install Poetry
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" poetry
poetry --version
{% endraw %}

- name: Set up Python
uses: actions/[email protected]
Expand Down
10 changes: 6 additions & 4 deletions {{cookiecutter.project_name}}/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ jobs:
uses: actions/[email protected]
with:
python-version: "3.12"

{% raw %}
- name: Upgrade pip
run: |
pip install -c .github/workflows/constraints.txt pip
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt pip
pip --version
{% endraw %}
{% raw %}
- name: Install Poetry
run: |
pip install -c .github/workflows/constraints.txt poetry
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt poetry
poetry --version
{% endraw %}

- name: Check if there is a parent commit
id: check-parent-commit
Expand Down
34 changes: 20 additions & 14 deletions {{cookiecutter.project_name}}/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ jobs:
uses: actions/[email protected]
with:
python-version: ${{"{{"}} matrix.python {{"}}"}}

{% raw %}
- name: Upgrade pip
run: |
pip install -c .github/workflows/constraints.txt pip
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt pip
pip --version
{% endraw %}

- name: Upgrade pip in virtual environments
shell: python
Expand All @@ -55,17 +56,19 @@ jobs:
with open(os.environ["GITHUB_ENV"], mode="a") as io:
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
{% raw %}
- name: Install Poetry
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" poetry
poetry --version
{% endraw %}
{% raw %}
- name: Install Nox
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" nox
pipx inject --pip-args "-c .github/workflows/constraints.txt" nox nox-poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox
pipx inject --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox nox-poetry
nox --version
{% endraw %}

- name: Compute pre-commit cache key
if: matrix.session == 'pre-commit'
Expand Down Expand Up @@ -123,22 +126,25 @@ jobs:
uses: actions/[email protected]
with:
python-version: "3.12"

{% raw %}
- name: Upgrade pip
run: |
pip install -c .github/workflows/constraints.txt pip
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt pip
pip --version
{% endraw %}
{% raw %}
- name: Install Poetry
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" poetry
poetry --version
{% endraw %}
{% raw %}
- name: Install Nox
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" nox
pipx inject --pip-args "-c .github/workflows/constraints.txt" nox nox-poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox
pipx inject --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox nox-poetry
nox --version
{% endraw %}

- name: Download coverage data
uses: actions/download-artifact@v4
Expand Down

0 comments on commit fdb18a9

Please sign in to comment.