From ea21ef62099d22a1a422982e58ce75902f87ded2 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 2 Apr 2022 05:01:30 -0500 Subject: [PATCH 1/4] ci(tests): Use poetry cache action This was added in https://github.com/actions/setup-python/releases/tag/v3.1.0 --- .github/workflows/tests.yml | 42 +++++++------------------------------ 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a53fc37..e17a1aa8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,17 +9,7 @@ jobs: matrix: python-version: [ '3.10' ] steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - - name: Get full Python version - id: full-python-version - shell: bash - run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") - + - uses: actions/checkout@v3 - name: Install poetry run: | curl -O -sSL https://install.python-poetry.org/install-poetry.py @@ -27,32 +17,14 @@ jobs: echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV rm install-poetry.py - - name: Add ~/.local/bin to PATH - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Get poetry cache paths from config - run: | - echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV - echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV - - - name: Configure poetry - shell: bash - run: poetry config virtualenvs.in-project true - - - name: Set up cache - uses: actions/cache@v2 - id: cache + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 with: - path: | - .venv - ${{ env.poetry_cache_dir }} - ${{ env.poetry_virtualenvs_path }} - key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} + python-version: ${{ matrix.python-version }} + cache: 'poetry' - - name: Ensure cache is healthy - if: steps.cache.outputs.cache-hit == 'true' - shell: bash - run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv + - name: Add ~/.local/bin to PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install dependencies run: poetry install -E "docs test coverage lint format" From f6e2e641880d5b2d56deafcdf3f24e9abbaa8930 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 2 Apr 2022 05:03:15 -0500 Subject: [PATCH 2/4] ci(tests): Update codecov ci action --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e17a1aa8..87dd326c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,6 +35,6 @@ jobs: - name: Test with pytest run: poetry run py.test --cov=./ --cov-report=xml - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }} From 03c77b15522cd7abd4990741dc49b716d3707088 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 2 Apr 2022 05:05:33 -0500 Subject: [PATCH 3/4] ci(docs): Use checkout@v3's (v3.1) poetry cache --- .github/workflows/docs.yml | 42 +++++++------------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d7faf742..859f5967 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,7 +12,7 @@ jobs: matrix: python-version: ["3.10"] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Filter changed file paths to outputs uses: dorny/paths-filter@v2.7.0 id: changes @@ -33,16 +33,6 @@ jobs: if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true' run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - - name: Get full Python version - id: full-python-version - shell: bash - run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") - - name: Install poetry run: | curl -O -sSL https://install.python-poetry.org/install-poetry.py @@ -50,32 +40,14 @@ jobs: echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV rm install-poetry.py - - name: Add ~/.local/bin to PATH - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Get poetry cache paths from config - run: | - echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV - echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV - - - name: Configure poetry - shell: bash - run: poetry config virtualenvs.in-project true - - - name: Set up cache - uses: actions/cache@v2 - id: cache + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 with: - path: | - .venv - {{ env.poetry_cache_dir }} - {{ env.poetry_virtualenvs_path }} - key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} + python-version: ${{ matrix.python-version }} + cache: 'poetry' - - name: Ensure cache is healthy - if: steps.cache.outputs.cache-hit == 'true' - shell: bash - run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv + - name: Add ~/.local/bin to PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install dependencies [w/ docs] run: poetry install --extras "docs lint" From 601ffef01462624cbe93b27cd8bddadc6370d0d2 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 2 Apr 2022 05:15:56 -0500 Subject: [PATCH 4/4] docs(CHANGES): Update --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index 75a93af3..fd997411 100644 --- a/CHANGES +++ b/CHANGES @@ -51,6 +51,8 @@ $ pip install --user --upgrade --pre libvcs - Add codeql analysis (:issue:`303`) - git test suite: Lots of parametrization (:issue:`309`) +- CI: Use poetry caching from + [@actions/setup v3.1](https://github.com/actions/setup-python/releases/tag/v3.1.0), (:issue:`316`) - New constants for `str` -> class mappings - {data}`libvcs.shortcuts.DEFAULT_VCS_CLASS_MAP`