Improve test workflow, add sync option, and enhance requirements checking #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Action | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| test-basic: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create test project | |
| run: | | |
| mkdir -p test-project | |
| cat > test-project/pyproject.toml << EOF | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| requires-python = ">=3.9" | |
| dependencies = [ | |
| "requests>=2.31.0", | |
| "pytest>=7.4.0", | |
| ] | |
| EOF | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| export PATH="$HOME/.local/bin:$PATH" | |
| - name: Generate lock file | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv sync | |
| - name: Test basic usage | |
| uses: ./ | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| test-requirements: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create test project | |
| run: | | |
| mkdir -p test-project | |
| cat > test-project/pyproject.toml << EOF | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| requires-python = ">=3.9" | |
| dependencies = [ | |
| "requests>=2.31.0", | |
| "pytest>=7.4.0", | |
| ] | |
| EOF | |
| - name: Install uv | |
| working-directory: test-project | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| export PATH="$HOME/.local/bin:$PATH" | |
| - name: Generate lock and requirements files | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv sync | |
| uv pip compile pyproject.toml -o requirements.txt | |
| - name: Test with requirements | |
| uses: ./ | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| requirements-path: requirements.txt | |
| requirements-command: uv pip compile pyproject.toml -o requirements.txt | |
| test-custom-requirements: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create test project | |
| run: | | |
| mkdir -p test-project | |
| cat > test-project/pyproject.toml << EOF | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| requires-python = ">=3.9" | |
| dependencies = [ | |
| "requests>=2.31.0", | |
| "pytest>=7.4.0", | |
| ] | |
| EOF | |
| - name: Install uv | |
| working-directory: test-project | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| export PATH="$HOME/.local/bin:$PATH" | |
| - name: Generate lock and platform-specific requirements | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv sync | |
| uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt | |
| - name: Test with custom requirements command | |
| uses: ./ | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| requirements-path: requirements-linux.txt | |
| requirements-command: uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt | |
| test-failure: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create test project | |
| run: | | |
| mkdir -p test-project | |
| cat > test-project/pyproject.toml << EOF | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| requires-python = ">=3.9" | |
| dependencies = [ | |
| "requests>=2.31.0", | |
| "pytest>=7.4.0", | |
| ] | |
| EOF | |
| - name: Generate lock file | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv sync | |
| - name: Modify pyproject.toml to cause failure | |
| working-directory: test-project | |
| run: | | |
| sed -i 's/requests>=2.31.0/requests>=2.32.0/' pyproject.toml | |
| - name: Test failure case | |
| uses: ./ | |
| continue-on-error: true | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| requirements-path: requirements.txt | |
| requirements-command: uv pip compile pyproject.toml -o requirements.txt | |
| test-requirements-failure: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup test project | |
| run: | | |
| mkdir -p test-project | |
| cat > test-project/pyproject.toml << EOF | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| requires-python = ">=3.9" | |
| dependencies = [ | |
| "requests>=2.31.0", | |
| "pytest>=7.4.0", | |
| ] | |
| EOF | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| export PATH="$HOME/.local/bin:$PATH" | |
| - name: Generate requirements.txt | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv pip compile pyproject.toml -o requirements.txt | |
| - name: Modify pyproject.toml | |
| run: | | |
| sed -i 's/pytest>=7.4.0/pytest>=7.5.0/' test-project/pyproject.toml | |
| - uses: ./ | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| requirements-path: requirements.txt | |
| requirements-command: uv pip compile pyproject.toml -o requirements.txt | |
| test-uv-lock-failure: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup test project | |
| run: | | |
| mkdir -p test-project | |
| cat > test-project/pyproject.toml << EOF | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| requires-python = ">=3.9" | |
| dependencies = [ | |
| "requests>=2.31.0", | |
| "pytest>=7.4.0", | |
| ] | |
| EOF | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| export PATH="$HOME/.local/bin:$PATH" | |
| - name: Generate uv.lock | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv sync | |
| - name: Modify pyproject.toml | |
| run: | | |
| sed -i 's/pytest>=7.4.0/pytest>=7.5.0/' test-project/pyproject.toml | |
| - name: Update uv.lock | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv sync | |
| - uses: ./ | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| requirements-path: requirements.txt | |
| requirements-command: uv pip compile pyproject.toml -o requirements.txt -- --platform linux | |
| test-multiple-requirements: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create test project | |
| run: | | |
| mkdir -p test-project | |
| cat > test-project/pyproject.toml << EOF | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| requires-python = ">=3.9" | |
| dependencies = [ | |
| "requests>=2.31.0", | |
| "pytest>=7.4.0", | |
| ] | |
| EOF | |
| - name: Install uv | |
| working-directory: test-project | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| export PATH="$HOME/.local/bin:$PATH" | |
| - name: Print uv version | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv --version | |
| - name: Generate requirements-linux.txt | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt | |
| - name: Generate requirements-win.txt | |
| working-directory: test-project | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv pip compile --python-platform=windows pyproject.toml -o requirements-win.txt | |
| - name: Check Linux Requirements | |
| uses: ./ | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| requirements-command: uv pip compile --python-platform=linux pyproject.toml -o requirements-linux.txt | |
| requirements-path: requirements-linux.txt | |
| - name: Check Windows Requirements | |
| uses: ./ | |
| with: | |
| pyproject-path: test-project/pyproject.toml | |
| requirements-command: uv pip compile --python-platform=windows pyproject.toml -o requirements-win.txt | |
| requirements-path: requirements-win.txt |