Skip to content

Commit

Permalink
DEV - Update dev environments (#838)
Browse files Browse the repository at this point in the history
Co-authored-by: Peyton Murray <[email protected]>
Co-authored-by: jaimergp <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 9, 2024
1 parent ce9fb01 commit 27106fd
Show file tree
Hide file tree
Showing 31 changed files with 360 additions and 356 deletions.
50 changes: 50 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
# Git
.git
.gitignore
.gitattributes

# Docker
docker-compose.yml
Dockerfile
.docker
.dockerignore

# python
**/__pycache__
dist
build
*.egg-info
.pytest_cache

# VSCode
.vscode/

# MacOS
**/.DS_Store

# playwright
screenshots
test-results

# ruff
.ruff_cache

# conda-store-ui
conda-store-server/conda_store_server/server/static/conda-store-ui/

# Docusaurus dependencies
/node_modules

# Docusaurus production
/build

# markdown
*.md
!README.md

# ------------------------
# conda-store specific
data
examples/docker/data

# test files
conda-store-server/tests
conda-store/tests
12 changes: 12 additions & 0 deletions .github/workflows/build_docker_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4

- name: "Get project's default Python version 🏷️"
run: |
echo "PYTHON_VERSION_DEFAULT=$(cat .python-version-default)" >> $GITHUB_ENV
- name: "Retrieve secret from Vault 🗝"
uses: hashicorp/vault-action@v3
with:
Expand Down Expand Up @@ -68,6 +72,12 @@ jobs:
type=ref,event=tag
type=sha
# we need this as we are setting the context to subproject directory
- name: "Copy .dockerignore"
run: |
cp .dockerignore ${{ matrix.docker-image }}/.dockerignore
shell: bash

- name: "Publish Docker image 🚀"
uses: docker/build-push-action@v5
with:
Expand All @@ -80,4 +90,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
python_version=${{ env.PYTHON_VERSION_DEFAULT }}
platforms: ${{ matrix.platform }}
7 changes: 2 additions & 5 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- macos-14
- windows-latest
# ubuntu 22.04, macos 14, windows 2022
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ permissions:
jobs:
# Always build & verify package.
build-package:
name: Build & verify package
name: "Build & verify package"
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -39,7 +39,7 @@ jobs:
- run: echo "Running on ${{ matrix.directory }}"

- name: "Check package build - ${{ matrix.directory }} 📦"
uses: hynek/build-and-inspect-python-package@main
uses: hynek/build-and-inspect-python-package@v2
with:
path: ${{ matrix.directory }}
upload-name-suffix: "-${{ matrix.directory }}"
Expand All @@ -55,7 +55,7 @@ jobs:
# Upload to Test PyPI on every commit on main
release-test-pypi:
name: Publish in-dev to test.pypi.org
name: "Publish in-dev to test.pypi.org"
environment: release-test-pypi
if: github.repository_owner == 'conda-incubator' && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
Expand All @@ -82,9 +82,9 @@ jobs:
print-hash: true
verbose: true


# Upload to PyPI on every tag/release
release-pypi:
name: Publish released package to pypi.org
name: "Publish released package to pypi.org"
environment: release-pypi
if: github.repository_owner == 'conda-incubator' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
Expand Down Expand Up @@ -128,6 +128,15 @@ jobs:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4

- name: "Get project's default Python version 🏷️"
run: |
echo "PYTHON_VERSION_DEFAULT=$(cat .python-version-default)" >> $GITHUB_ENV
- name: "Copy .dockerignore"
run: |
cp .dockerignore ${{ matrix.docker-image }}/.dockerignore
shell: bash

- name: "Retrieve secret from Vault 🗝"
uses: hashicorp/vault-action@v2
with:
Expand Down Expand Up @@ -177,6 +186,7 @@ jobs:
file: "${{ matrix.docker-image }}/Dockerfile"
build-args: |
RELEASE_VERSION=${{github.ref_name}}
python_version=${{ env.PYTHON_VERSION_DEFAULT }}
tags: |
${{ steps.meta.outputs.tags }}
push: true
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/test_build_docker_image.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Test build Docker image"

env:
DEFAULT_PYTHON_VERSION: "3.10"
FORCE_COLOR: "1" # Make tools pretty.
PYTHONUNBUFFERED: "1" # Make stdout and stderr behave well

on:
pull_request:
Expand All @@ -20,7 +20,7 @@ on:

# ensuring only one instance is running at a given time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
Expand All @@ -39,7 +39,11 @@ jobs:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4

- name: "Set up Docker Buildx"
- name: "Get project's default Python version 🏷️"
run: |
echo "PYTHON_VERSION_DEFAULT=$(cat .python-version-default)" >> $GITHUB_ENV
- name: "Set up Docker Buildx 🏗"
uses: docker/setup-buildx-action@v3

- name: "Lint Dockerfiles 🔍"
Expand All @@ -49,7 +53,12 @@ jobs:
output_format: tty
error_level: 0

- name: "Docker Meta"
- name: "Copy .dockerignore"
run: |
cp .dockerignore ${{ matrix.docker-image }}/.dockerignore
shell: bash

- name: "Add Docker metadata 📝"
id: meta
uses: docker/metadata-action@v5
with:
Expand All @@ -58,7 +67,7 @@ jobs:
tags: |
type=sha
- name: "Build Docker images"
- name: "Build Docker images 🐳"
uses: docker/build-push-action@v5
with:
context: "${{ matrix.docker-image }}"
Expand All @@ -70,4 +79,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
python_version=${{ env.PYTHON_VERSION_DEFAULT }}
platforms: ${{ matrix.platform }}
25 changes: 10 additions & 15 deletions .github/workflows/test_conda_store.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Test conda-store"

env:
DEFAULT_PYTHON_VERSION: "3.10"
FORCE_COLOR: "1" # Make tools pretty.
PYTHONUNBUFFERED: "1" # Make stdout and stderr behave well

on:
pull_request:
Expand All @@ -20,7 +20,7 @@ on:

# ensuring only one instance is running at a given time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
Expand All @@ -40,34 +40,29 @@ jobs:
- name: "Set up Python 🐍"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version-file: .python-version-default
cache: "pip"

- name: "Install Dependencies 📦"
run: |
pip install hatch
sudo apt install wait-for-it -y
python -m pip install hatch
# install conda-store
pip install .
- name: "Linting Checks 🧹"
run: |
hatch env run -e lint lint
- name: "Build package 📦"
run: |
hatch build
- name: "Deploy docker-compose"
- name: "Deploy docker compose 🏗️"
run: |
docker-compose up -d
docker compose up -d
docker ps
wait-for-it localhost:5432 # postgresql
wait-for-it localhost:9000 # minio
wait-for-it localhost:8080 # conda-store-server
- name: "Install conda-store for tests 📦"
run: |
pip install .
- name: "Run basic tests - not authenticated"
run: |
sleep 20
Expand All @@ -88,4 +83,4 @@ jobs:
- name: "Get Docker logs 🔍"
if: ${{ failure() }}
run: |
docker-compose logs
docker compose logs
42 changes: 25 additions & 17 deletions .github/workflows/test_conda_store_server_integration.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Test conda-store-server (integration)"

env:
DEFAULT_PYTHON_VERSION: "3.10"
FORCE_COLOR: "1" # Make tools pretty.
PYTHONUNBUFFERED: "1" # Make stdout and stderr behave well

on:
pull_request:
Expand All @@ -20,12 +20,12 @@ on:

# ensuring only one instance is running at a given time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
integration-test-conda-store-server:
name: "integration-test conda-store-server"
name: "integration-test - ${{ matrix.test-type }}"
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -38,20 +38,29 @@ jobs:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4

- name: "Set up env 🐍"
- name: "Get project's default Python version 🏷️"
run: |
echo "PYTHON_VERSION_DEFAULT=$(cat .python-version-default)" >> $GITHUB_ENV
- name: "Set up conda env 🐍"
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: conda-store-server/environment-dev.yaml
miniforge-version: latest
environment-file: conda-store-server/environment-dev.yaml
miniforge-version: latest
auto-activate-base: false
activate-environment: conda-store-server-dev
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}

- name: "Install build dependencies 📦"
- name: "Install dependencies 📦"
run: |
pip install hatch
which python
sudo apt install wait-for-it -y
# install conda-store-server
python -m pip install .
- name: "Deploy docker-compose"
- name: "Deploy docker compose 🏗️"
run: |
docker-compose up -d
docker compose up -d
docker ps
wait-for-it localhost:5432 # postgresql
Expand All @@ -61,29 +70,28 @@ jobs:
- name: "Run Playwright tests 🎭"
run: |
playwright install
pytest --video on ../tests/test_playwright.py
python -m playwright install --with-deps chromium
python -m pytest --video on ../tests/test_playwright.py
if: matrix.test-type == 'playwright'

- name: "Upload test results 📤"
uses: actions/upload-artifact@v4
if: ${{ always() }} && matrix.test-type == 'playwright'
if: matrix.test-type == 'playwright'
with:
name: playwright-tests
path: conda-store-server/test-results

- name: "Run integration tests ✅"
run: |
export PYTHONPATH=$PYTHONPATH:$PWD
pytest ../tests/test_api.py ../tests/test_metrics.py
python -m pytest ../tests/test_api.py ../tests/test_metrics.py
if: matrix.test-type == 'integration'

- name: "Run user journey tests ✅"
run: |
pytest -m "user_journey"
python -m pytest -m "user_journey"
if: matrix.test-type == 'user-journey'

- name: "Get Docker logs 🔍"
if: ${{ failure() }}
run: |
docker-compose logs
docker compose logs
Loading

0 comments on commit 27106fd

Please sign in to comment.