-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run tests as separate jobs #813
Changes from all commits
9b13943
ff88153
ab96f38
9bae83b
80f5b37
b828ed2
7b43d52
052e77e
996b517
c7a6220
d3f4a9f
d36ff4c
e8159cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,62 @@ | ||||||
name: "Test build Docker image" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had a similar idea as well, but decided against it to avoid confusion. We already have a job called In the interest of time, I'm going to merge this as is since it's already approved, but this can always be resolved in followup PRs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it is not testing the docker image just building it the fact that we have a step/job named build and push is inconsequential to having a workflow named build or build and push. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think a better name might be "Build Docker image", but we already have a file called I think my preferred solution would be making all these consistent, so that the name matches the filename and there are no clashes between files. Something like this (untested):
@peytondmurray Hey Peyton, I'm currently on PTO, would you be comfortable taking over this in a separate PR? The task would be coming up with a consistent scheme for names and filenames of docker workflows. |
||||||
|
||||||
env: | ||||||
DEFAULT_PYTHON_VERSION: "3.10" | ||||||
FORCE_COLOR: "1" # Make tools pretty. | ||||||
|
||||||
on: | ||||||
pull_request: | ||||||
push: | ||||||
branches: | ||||||
- main | ||||||
|
||||||
|
||||||
# ensuring only one instance is running at a given time | ||||||
concurrency: | ||||||
group: ${{ github.workflow }}-${{ github.ref }} | ||||||
peytondmurray marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cancel-in-progress: true | ||||||
|
||||||
jobs: | ||||||
build-docker-image: | ||||||
name: "Build docker images" | ||||||
runs-on: ubuntu-latest | ||||||
strategy: | ||||||
matrix: | ||||||
docker-image: | ||||||
- conda-store | ||||||
- conda-store-server | ||||||
steps: | ||||||
- name: "Checkout Repository 🛎" | ||||||
uses: actions/checkout@v4 | ||||||
|
||||||
- name: "Set up Docker Buildx" | ||||||
uses: docker/setup-buildx-action@v3 | ||||||
|
||||||
- name: "Lint Dockerfiles 🔍" | ||||||
uses: jbergstroem/hadolint-gh-action@v1 | ||||||
with: | ||||||
dockerfile: ${{ matrix.docker-image }}/Dockerfile | ||||||
output_format: tty | ||||||
error_level: 0 | ||||||
|
||||||
- name: "Docker Meta" | ||||||
id: meta | ||||||
uses: docker/metadata-action@v5 | ||||||
with: | ||||||
images: | | ||||||
quansight/${{ matrix.docker-image }} | ||||||
tags: | | ||||||
type=sha | ||||||
|
||||||
- name: "Build Docker images" | ||||||
uses: docker/build-push-action@v5 | ||||||
with: | ||||||
context: "${{ matrix.docker-image }}" | ||||||
file: "${{ matrix.docker-image }}/Dockerfile" | ||||||
tags: | | ||||||
${{ steps.meta.outputs.tags }} | ||||||
target: "dev" | ||||||
push: false | ||||||
labels: ${{ steps.meta.outputs.labels }} | ||||||
cache-from: type=gha | ||||||
cache-to: type=gha,mode=max |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: "Test conda-store" | ||
|
||
env: | ||
DEFAULT_PYTHON_VERSION: "3.10" | ||
FORCE_COLOR: "1" # Make tools pretty. | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
# ensuring only one instance is running at a given time | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test-conda-store: | ||
name: "integration-test conda-store" | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: conda-store | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- name: "Checkout Repository 🛎" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Set up Python 🐍" | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: "Install Dependencies 📦" | ||
run: | | ||
pip install hatch | ||
sudo apt install wait-for-it -y | ||
|
||
- name: "Linting Checks 🧹" | ||
run: | | ||
hatch env run -e lint lint | ||
|
||
- name: "Build package 📦" | ||
run: | | ||
hatch build | ||
|
||
- name: "Deploy docker-compose" | ||
run: | | ||
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 | ||
./tests/unauthenticated-tests.sh | ||
peytondmurray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: "Run basic tests - authenticated" | ||
run: | | ||
./tests/authenticated-tests.sh | ||
|
||
- name: "Test shebang" | ||
run: | | ||
export CONDA_STORE_URL=http://localhost:8080/conda-store | ||
export CONDA_STORE_AUTH=basic | ||
export CONDA_STORE_USERNAME=username | ||
export CONDA_STORE_PASSWORD=password | ||
./tests/shebang.sh | ||
|
||
- name: "Get Docker logs 🔍" | ||
if: ${{ failure() }} | ||
run: | | ||
docker-compose logs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: "Test conda-store-server (integration)" | ||
|
||
env: | ||
DEFAULT_PYTHON_VERSION: "3.10" | ||
FORCE_COLOR: "1" # Make tools pretty. | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
# ensuring only one instance is running at a given time | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
integration-test-conda-store-server: | ||
name: "integration-test conda-store-server" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
test-type: ["playwright", "integration", "user-journey"] | ||
peytondmurray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
working-directory: conda-store-server | ||
steps: | ||
- name: "Checkout Repository 🛎" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Set up env 🐍" | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
environment-file: conda-store-server/environment-dev.yaml | ||
miniforge-version: latest | ||
|
||
- name: "Install build dependencies 📦" | ||
run: | | ||
pip install hatch | ||
sudo apt install wait-for-it -y | ||
|
||
- name: "Deploy docker-compose" | ||
run: | | ||
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 | ||
sleep 10 # give the server more time to initialize | ||
peytondmurray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: "Run Playwright tests 🎭" | ||
run: | | ||
playwright install | ||
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' | ||
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 | ||
if: matrix.test-type == 'integration' | ||
|
||
- name: "Run user journey tests ✅" | ||
run: | | ||
pytest -m "user_journey" | ||
if: matrix.test-type == 'user-journey' | ||
peytondmurray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: "Get Docker logs 🔍" | ||
if: ${{ failure() }} | ||
run: | | ||
docker-compose logs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: "Test conda-store-server (unit)" | ||
|
||
env: | ||
DEFAULT_PYTHON_VERSION: "3.10" | ||
FORCE_COLOR: "1" # Make tools pretty. | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
# ensuring only one instance is running at a given time | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test-conda-store-server: | ||
name: "unit-test conda-store-server" | ||
strategy: | ||
matrix: | ||
os: ["ubuntu", "macos", "windows"] | ||
include: | ||
- os: ubuntu | ||
environment-file: conda-store-server/environment-dev.yaml | ||
- os: macos | ||
environment-file: conda-store-server/environment-macos-dev.yaml | ||
- os: windows | ||
environment-file: conda-store-server/environment-windows-dev.yaml | ||
runs-on: ${{ matrix.os }}-latest | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
working-directory: conda-store-server | ||
steps: | ||
- name: "Checkout Repository 🛎" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Set up env ${{ matrix.os }} 🐍" | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
environment-file: ${{ matrix.environment-file }} | ||
miniforge-version: latest | ||
|
||
# This fixes a "DLL not found" issue importing ctypes from the hatch env | ||
- name: "Reinstall Python 3.10 on Windows runner" | ||
uses: nick-fields/[email protected] | ||
with: | ||
timeout_minutes: 9999 | ||
peytondmurray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
max_attempts: 6 | ||
command: | ||
conda install --channel=conda-forge --quiet --yes python=${{ matrix.python }} | ||
if: matrix.os == 'windows' | ||
|
||
- name: "Linting Checks 🧹" | ||
run: | | ||
hatch env run -e lint lint | ||
|
||
- name: "Build package 📦" | ||
run: | | ||
hatch build | ||
|
||
- name: "Unit tests ✅" | ||
run: | | ||
pytest -m "not extended_prefix and not user_journey" tests | ||
|
||
# https://github.com/actions/runner-images/issues/1052 | ||
- name: "Windows extended prefix unit tests ✅" | ||
shell: pwsh | ||
run: | | ||
Set-ItemProperty "HKLM:\System\CurrentControlSet\Control\FileSystem" ` | ||
-Name "LongPathsEnabled" ` | ||
-Value 0 ` | ||
-Type DWord | ||
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled | ||
pytest -m "extended_prefix" tests | ||
if: matrix.os == 'windows' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should perhaps rename it to
build_docker.yaml
as it is not testing the Docker image per se