diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9e4a62b43..6a8fa4a44 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -38,7 +38,7 @@ jobs: - "3.11" fail-fast: false concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ matrix.python-version }} cancel-in-progress: true steps: - name: "Checkout Infrastructure" @@ -54,10 +54,6 @@ jobs: channels: conda-forge,defaults activate-environment: nebari-dev - - name: Install conda-build - run: | - conda install --quiet --yes conda-build - - name: Install Nebari run: | python --version diff --git a/.github/workflows/test_aws_integration.yaml b/.github/workflows/test_aws_integration.yaml index dcdfc4fe3..fa1a2332d 100644 --- a/.github/workflows/test_aws_integration.yaml +++ b/.github/workflows/test_aws_integration.yaml @@ -56,7 +56,6 @@ jobs: - name: Install Nebari run: | pip install .[dev] - conda install --quiet --yes conda-build playwright install - name: Retrieve secret from Vault diff --git a/.github/workflows/test_conda_build.yaml b/.github/workflows/test_conda_build.yaml new file mode 100644 index 000000000..e34363d9a --- /dev/null +++ b/.github/workflows/test_conda_build.yaml @@ -0,0 +1,54 @@ +name: "Test Conda Build" + +on: + pull_request: + paths: + - ".github/workflows/test_conda_build.yaml" + - "pyproject.toml" + push: + branches: + - main + - develop + - release/\d{4}.\d{1,2}.\d{1,2} + paths: + - ".github/workflows/test_conda_build.yaml" + - "pyproject.toml" + +jobs: + test-conda-build: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -el {0} + concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + steps: + - name: "Checkout Infrastructure" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + channels: conda-forge + activate-environment: nebari-dev + + - name: Install dependencies + run: | + conda install build grayskull conda-build + + - name: Generate sdist + run: | + python -m build --sdist + + - name: Generate meta.yaml + run: | + python -m grayskull pypi dist/*.tar.gz + + - name: Build conda package + run: | + conda build nebari diff --git a/.github/workflows/test_do_integration.yaml b/.github/workflows/test_do_integration.yaml index c4aa36742..dbe10a302 100644 --- a/.github/workflows/test_do_integration.yaml +++ b/.github/workflows/test_do_integration.yaml @@ -54,7 +54,6 @@ jobs: - name: Install Nebari run: | pip install .[dev] - conda install --quiet --yes conda-build playwright install - name: Retrieve secret from Vault diff --git a/.github/workflows/test_gcp_integration.yaml b/.github/workflows/test_gcp_integration.yaml index 32a981d96..57ef84288 100644 --- a/.github/workflows/test_gcp_integration.yaml +++ b/.github/workflows/test_gcp_integration.yaml @@ -55,7 +55,6 @@ jobs: - name: Install Nebari run: | pip install .[dev] - conda install --quiet --yes conda-build playwright install - name: Retrieve secret from Vault diff --git a/pyproject.toml b/pyproject.toml index c2f479fe5..63f0835cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,8 +91,6 @@ dev = [ "pytest-playwright", "pytest-cov", "coverage[toml]", - "grayskull", - "build", "jinja2", "setuptools==63.4.3", ] diff --git a/pytest.ini b/pytest.ini index 7341aae58..0555ec6b2 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,7 +7,6 @@ addopts = # turn warnings into errors -Werror markers = - conda: conda required to run this test (deselect with '-m \"not conda\"') gpu: test gpu working properly preemptible: test preemptible instances testpaths = diff --git a/tests/tests_unit/test_dependencies.py b/tests/tests_unit/test_dependencies.py index 38e891e25..bcde584e0 100644 --- a/tests/tests_unit/test_dependencies.py +++ b/tests/tests_unit/test_dependencies.py @@ -1,72 +1,7 @@ -import subprocess import urllib -from pathlib import Path - -import pytest from _nebari.provider import terraform -SRC_DIR = Path(__file__).parent.parent.parent -PYPROJECT = SRC_DIR / "pyproject.toml" - - -@pytest.mark.conda -def test_build_by_conda_forge(tmp_path): - """ - This test ensures that nebari can be built and packaged by conda-forge. - - This is achieved by walking through the following steps: - 1. Use Python build package to generate the `sdist` .tar.gz file - 2. Use grayskull package to generate the `meta.yaml` recipe file - 3. Use conda build to attempt to build the nebari package from the `meta.yaml` - - These steps mimic what takes places on the conda-forge/nebari-feedstock repo whenever - a new version of the package gets released. - - NOTE: this test requires conda and conda-build - """ - - assert PYPROJECT.exists() - - try: - # build sdist - subprocess.run( - ["python", "-m", "build", SRC_DIR, "--outdir", tmp_path], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - check=True, - ) - - # get location of sdist file built above - sdist_loc = next(tmp_path.glob("*.tar.gz")) - # run grayskull to create the meta.yaml using the local sdist file - subprocess.run( - [ - "grayskull", - "pypi", - "--strict-conda-forge", - sdist_loc, - "--output", - tmp_path, - ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - check=True, - ) - - # get the directory the meta.yaml is in - meta_loc = tmp_path / "nebari" - # try to run conda build to build package from meta.yaml - subprocess.run( - ["conda", "build", "--channel=conda-forge", meta_loc], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - check=True, - ) - except subprocess.CalledProcessError as e: - print(e.stderr.decode("utf-8")) - raise e - def test_terraform_open_source_license(): tf_version = terraform.version()