From 2aaf7ac638ee0badeaeba1b8d3bc243fbbe7a55a Mon Sep 17 00:00:00 2001 From: Schuyler Martin Date: Wed, 13 Dec 2023 13:36:58 -0700 Subject: [PATCH 1/2] Version 0.1.3 of percy --- .github/actions/setup-env/action.yaml | 34 +++++++++++++++ .github/workflows/build-linux.yml | 35 --------------- .github/workflows/ci.yaml | 63 +++++++++++++++++++++++++++ .github/workflows/pre-commit.yml | 31 ------------- CHANGELOG.md | 5 +++ conda.recipe/meta.yaml | 49 --------------------- environment.yaml | 2 +- pyproject.toml | 2 +- 8 files changed, 104 insertions(+), 117 deletions(-) create mode 100644 .github/actions/setup-env/action.yaml delete mode 100644 .github/workflows/build-linux.yml create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/pre-commit.yml delete mode 100644 conda.recipe/meta.yaml diff --git a/.github/actions/setup-env/action.yaml b/.github/actions/setup-env/action.yaml new file mode 100644 index 0000000..268371f --- /dev/null +++ b/.github/actions/setup-env/action.yaml @@ -0,0 +1,34 @@ +name: Set up environment +description: Set up an percy environment + +runs: + using: "composite" + steps: + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 + with: + python-version: ${{ inputs.python-version }} + cache: 'pip' + - name: Cache conda env + id: cache-conda + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 + env: + cache-name: conda-env-cache + with: + cache: 'pip' + path: '/usr/share/miniconda/envs' + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/environment.yml') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Create Environment + shell: bash + if: ${{ steps.cache-conda.outputs.cache-hit == false }} + # NOTE: We use `sed` to force a Python version in the `environment.yaml` file + run: | + conda update -n base -c defaults conda + source $CONDA/etc/profile.d/conda.sh + conda init bash + sed -i 's/- python >=3.*$/- python ${{ inputs.python-version }}.*/' environment.yaml + conda env create -f environment.yaml --name percy --force + conda run --name percy pip install . diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml deleted file mode 100644 index ab90cc5..0000000 --- a/.github/workflows/build-linux.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Python package -on: - push: - branches: - - main - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 - with: - python-version: ${{ matrix.python-version }} - - name: Update pip - run: | - python -m pip install --upgrade pip - - name: Update conda - run: | - conda update -n base -c defaults conda - conda install -n base conda-libmamba-solver - source $CONDA/etc/profile.d/conda.sh - conda env create -f environment.yaml --solver=libmamba --name percy - conda init bash - conda activate percy - - name: Install dev and test dependencies - run: | - source $CONDA/etc/profile.d/conda.sh - pip install -e .[dev] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..2aa97fc --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,63 @@ +on: + push: + branches: + - main + pull_request: + +name: Test + +jobs: + # NOTE: Tests run via `pre-commit` + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: ./.github/actions/setup-env + with: + python-version: "3.11" + # Executes `pre-commit` with the `make` directive to ensure all dependencies are found + - run: | + source $CONDA/bin/activate + conda activate percy + make pre-commit + test: + runs-on: ubuntu-latest + name: Test on ${{ matrix.python-version }} + strategy: + matrix: + python-version: ["3.12"] + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: ./.github/actions/setup-env + with: + python-version: ${{ matrix.python-version }} + - run: | + source $CONDA/bin/activate + conda activate percy + make test + build-recipe: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: AnacondaRecipes/percy-feedstock + path: ./feedstock + - name: Cache conda env + id: cache-conda + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 + env: + cache-name: conda-env-cache + with: + path: '/usr/share/miniconda/envs' + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/environment.yml') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Build package + run: | + cp -r ./feedstock/abs.yaml ./feedstock/recipe . + source $CONDA/bin/activate + conda install conda-build + conda-build -c distro-tooling . diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 44ea320..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Runs pre-commit checks, including static analyzer. -# For now, we only run tests on the latest supported version of Python. - -on: - push: - branches: - - main - pull_request: - -name: pre-commit checks and tests - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 - with: - python-version: '3.11' - cache: 'pip' - - name: Install dependencies - # Create a conda environment with all of percy's dependencies. Then - # run pre-commit, which triggers a handful of `make` commands - run: | - conda update -n base -c defaults conda - source $CONDA/etc/profile.d/conda.sh - conda init bash - conda env create -f environment.yaml --name percy --force - conda run --name percy pip install . - conda activate percy - make pre-commit diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2931c..09bf61f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog Note: version releases in the 0.x.y range may introduce breaking changes. +## 0.1.3 +- Limiting the project to Python >=3.11 for easier maintenance +- Fixes and improves our GitHub Actions workflows to our latest standards +- Removes the current recipe file in favor of using the feedstock as our source of truth. + ## 0.1.2 - Fixes bug with reporting typing (`py.typed` was in the wrong location) - Fixes and improves infrastructure diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml deleted file mode 100644 index ebd434d..0000000 --- a/conda.recipe/meta.yaml +++ /dev/null @@ -1,49 +0,0 @@ -package: - name: percy - version: 0.1.2 - -source: - path: ../ - -build: - number: 0 - noarch: python - script: pip install . --no-deps --no-build-isolation -vv - entry_points: - - percy = percy.commands.main:cli - -requirements: - host: - - python - - pip - - setuptools - - wheel - run: - - python >=3.8 - - click >=8.1.7 - - conda - - jinja2 - - pyyaml - - requests - - jsonschema - -test: - imports: - - percy.render.recipe - - percy.render.aggregate - - percy.repodata.repodata - requires: - - pip - commands: - - pip check - -about: - home: https://github.com/anaconda-distribution/percy - license: BSD-3-Clause - license_family: BSD - license_file: LICENSE - summary: Helper tool for recipes on aggregate. - description: | - Renders local recipes, provides build orders, find outdated recipes. - doc_url: https://github.com/anaconda-distribution/percy - dev_url: https://github.com/anaconda-distribution/percy diff --git a/environment.yaml b/environment.yaml index c851fc4..3cb817a 100644 --- a/environment.yaml +++ b/environment.yaml @@ -7,7 +7,7 @@ dependencies: - isort - make - mypy - - python>=3.8 + - python >=3.11 - pytest - pytest-cov - pytest-xdist diff --git a/pyproject.toml b/pyproject.toml index 114a07f..5736995 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ namespaces = false [project] name = "percy" -version = "0.1.2" +version = "0.1.3" authors = [ { name="Anaconda, Inc.", email="distribution_team@anaconda.com" }, ] From f5e911681d41d1d0c3add53177fb631f9c72aa00 Mon Sep 17 00:00:00 2001 From: Schuyler Martin Date: Wed, 13 Dec 2023 13:40:58 -0700 Subject: [PATCH 2/2] Testing on 3.11 only; 3.12 not ready --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2aa97fc..e9df5c2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: name: Test on ${{ matrix.python-version }} strategy: matrix: - python-version: ["3.12"] + python-version: ["3.11"] # TODO: Bump this to 3.12 when supported and drop 3.11 (covered in pre-commit) steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - uses: ./.github/actions/setup-env