Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions .github/actions/run-integration-tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Run Integration Tests
description: Run integration tests for hatch-dotenv plugin

inputs:
package:
description: 'The hatch-dotenv package requirement (e.g., "hatch-dotenv" for PyPI or "hatch-dotenv @ file:///path/to/repo" for local)'
required: false
default: 'hatch-dotenv'

runs:
using: composite
steps:
Expand All @@ -10,27 +16,6 @@ runs:
- name: Setup Hatch
uses: ./.github/actions/setup-hatch

- name: Install package in editable mode
shell: bash
run: pip install -e .

- name: Create test env files for happy-test
shell: bash
run: |
echo "MY_SECRET=abcde" > integration_tests/happy-test/.env
echo "MY_SECOND_SECRET=secret" > integration_tests/happy-test/.env.local

- name: Create test env files for missing-test
shell: bash
run: |
echo "SECRET=12345" > integration_tests/missing-test/.env

- name: Run happy-test
shell: bash
working-directory: integration_tests/happy-test
run: hatch run python -m happy_test

- name: Run missing-test
- name: Run integration tests
shell: bash
working-directory: integration_tests/missing-test
run: hatch run python -m missing_test
run: ./integration_tests/run_tests_no_cache_clear.sh "${{ inputs.package }}"
9 changes: 9 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-unit-tests

integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/run-integration-tests
with:
package: "hatch-dotenv @ file://${{ github.workspace }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,5 @@ marimo/_static/
marimo/_lsp/
__marimo__/
.hatch
integration_tests/missing-test/pyproject.toml
integration_tests/happy-test/pyproject.toml
1 change: 1 addition & 0 deletions integration_tests/happy-test/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MY_SECRET=abcde
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ dependencies = []
path = "src/happy_test/__about__.py"

[tool.hatch.env]
requires = ["hatch-dotenv"]
requires = ["{{HATCH_DOTENV_PACKAGE}}"]

[tool.hatch.env.collectors.dotenv.default]
env-files = [".env", ".env.local"]
env-files = [".env.test", ".env.local"]

[tool.hatch.envs.default]
installer = "uv"
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies = []
path = "src/missing_test/__about__.py"

[tool.hatch.env]
requires = ["hatch-dotenv"]
requires = ["{{HATCH_DOTENV_PACKAGE}}"]

[tool.hatch.env.collectors.dotenv.default]
env-files = [".env.test", ".env"]
Expand Down
20 changes: 17 additions & 3 deletions integration_tests/run_tests_hatch_pip.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
#!/bin/bash

set -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

# Default to "hatch-dotenv" if no argument provided
HATCH_DOTENV_PACKAGE="${1:-hatch-dotenv}"

# Generate pyproject.toml from template
generate_pyproject() {
local dir="$1"
sed "s|{{HATCH_DOTENV_PACKAGE}}|$HATCH_DOTENV_PACKAGE|g" "$dir/pyproject.toml.in" > "$dir/pyproject.toml"
}

generate_pyproject "$SCRIPT_DIR/happy-test"
generate_pyproject "$SCRIPT_DIR/missing-test"

cd "$SCRIPT_DIR/happy-test"
pip uninstall hatch-dotenv -y
pip uninstall hatch-dotenv -y || true
pip cache purge
hatch run python -m happy_test

cd "$SCRIPT_DIR/missing-test"
pip uninstall hatch-dotenv -y
pip uninstall hatch-dotenv -y || true
pip cache purge
hatch run python -m missing_test
hatch run python -m missing_test
20 changes: 17 additions & 3 deletions integration_tests/run_tests_hatch_pipx.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
#!/bin/bash

set -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

# Default to "hatch-dotenv" if no argument provided
HATCH_DOTENV_PACKAGE="${1:-hatch-dotenv}"

# Generate pyproject.toml from template
generate_pyproject() {
local dir="$1"
sed "s|{{HATCH_DOTENV_PACKAGE}}|$HATCH_DOTENV_PACKAGE|g" "$dir/pyproject.toml.in" > "$dir/pyproject.toml"
}

generate_pyproject "$SCRIPT_DIR/happy-test"
generate_pyproject "$SCRIPT_DIR/missing-test"

cd "$SCRIPT_DIR/happy-test"
pipx runpip hatch uninstall hatch-dotenv -y
pipx runpip hatch uninstall hatch-dotenv -y || true
hatch run pip cache purge
hatch run python -m happy_test

cd "$SCRIPT_DIR/missing-test"
pipx runpip hatch uninstall hatch-dotenv -y
pipx runpip hatch uninstall hatch-dotenv -y || true
hatch run pip cache purge
hatch run python -m missing_test
hatch run python -m missing_test
23 changes: 23 additions & 0 deletions integration_tests/run_tests_no_cache_clear.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

# Default to "hatch-dotenv" if no argument provided
HATCH_DOTENV_PACKAGE="${1:-hatch-dotenv}"

# Generate pyproject.toml from template
generate_pyproject() {
local dir="$1"
sed "s|{{HATCH_DOTENV_PACKAGE}}|$HATCH_DOTENV_PACKAGE|g" "$dir/pyproject.toml.in" > "$dir/pyproject.toml"
}

generate_pyproject "$SCRIPT_DIR/happy-test"
generate_pyproject "$SCRIPT_DIR/missing-test"

cd "$SCRIPT_DIR/happy-test"
hatch run python -m happy_test

cd "$SCRIPT_DIR/missing-test"
hatch run python -m missing_test