canonicalize urls for homebrew / debian / pkgx #82
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: CI | |
on: | |
workflow_dispatch: | |
inputs: | |
env: | |
description: "The environment to test against" | |
required: false | |
type: choice | |
options: | |
- dev | |
- sepolia | |
- testnet | |
- mainnet | |
default: 'dev' | |
push: | |
branches: ["main"] | |
paths: | |
- "**/*.py" | |
- "tests/**" | |
- "core/**" | |
- "package_managers/**" | |
pull_request: | |
branches: ["main"] | |
paths: | |
- "**/*.py" | |
- "tests/**" | |
- "core/**" | |
- "package_managers/**" | |
permissions: | |
contents: read | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
core: ${{ steps.filter.outputs.core }} | |
crates: ${{ steps.filter.outputs.crates }} | |
homebrew: ${{ steps.filter.outputs.homebrew }} | |
debian: ${{ steps.filter.outputs.debian }} | |
pkgx: ${{ steps.filter.outputs.pkgx }} | |
any_changes: ${{ steps.filter.outputs.any_changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
core: | |
- 'core/**' | |
- 'tests/unit/test_db_models.py' | |
crates: | |
- 'package_managers/crates/**' | |
- 'tests/unit/test_crates_transformer.py' | |
homebrew: | |
- 'package_managers/homebrew/**' | |
debian: | |
- 'package_managers/debian/**' | |
pkgx: | |
- 'package_managers/pkgx/**' | |
system: | |
- 'tests/system/**' | |
- name: Set any_changes output | |
id: set-any-changes | |
run: | | |
if [[ "${{ steps.filter.outputs.core }}" == "true" || \ | |
"${{ steps.filter.outputs.crates }}" == "true" || \ | |
"${{ steps.filter.outputs.homebrew }}" == "true" || \ | |
"${{ steps.filter.outputs.debian }}" == "true" || \ | |
"${{ steps.filter.outputs.pkgx }}" == "true" || \ | |
"${{ steps.filter.outputs.system }}" == "true" ]]; then | |
echo "any_changes=true" >> $GITHUB_OUTPUT | |
else | |
echo "any_changes=false" >> $GITHUB_OUTPUT | |
fi | |
test: | |
needs: changes | |
if: ${{ needs.changes.outputs.any_changes == 'true' || github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
environment: ${{ inputs.env || 'dev' }} | |
steps: | |
- name: Debug Changes | |
run: | | |
echo "Any changes detected: ${{ needs.changes.outputs.any_changes }}" | |
echo "Core changes: ${{ needs.changes.outputs.core }}" | |
echo "Crates changes: ${{ needs.changes.outputs.crates }}" | |
echo "Homebrew changes: ${{ needs.changes.outputs.homebrew }}" | |
echo "Debian changes: ${{ needs.changes.outputs.debian }}" | |
echo "Pkgx changes: ${{ needs.changes.outputs.pkgx }}" | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r tests/requirements.txt | |
- name: Set environment | |
id: set-env | |
run: | | |
TEST_ENV="dev" | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
TEST_ENV=${{ inputs.env }} | |
fi | |
echo "TEST_ENV=${TEST_ENV}" >> $GITHUB_ENV | |
echo "test_env=${TEST_ENV}" >> $GITHUB_OUTPUT | |
- name: Run Crates Transformer Tests | |
if: ${{ needs.changes.outputs.crates == 'true' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "Running Crates tests for environment: ${{ env.TEST_ENV }}" | |
if [ -f "tests/unit/test_crates_transformer.py" ]; then | |
pytest tests/unit/test_crates_transformer.py -v -m transformer --cov=core --cov-report=xml --cov-report=term-missing || echo "Tests failed but continuing workflow" | |
else | |
echo "Warning: tests/unit/test_crates_transformer.py not found" | |
ls -la tests/unit/ || echo "Cannot list tests/unit directory" | |
fi | |
- name: Run DB Model Tests | |
if: ${{ needs.changes.outputs.core == 'true' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "Running DB model tests for environment: ${{ env.TEST_ENV }}" | |
if [ -f "tests/unit/test_db_models.py" ]; then | |
pytest tests/unit/test_db_models.py -v -m db --cov=core --cov-append --cov-report=xml --cov-report=term-missing || echo "Tests failed but continuing workflow" | |
else | |
echo "Warning: tests/unit/test_db_models.py not found" | |
ls -la tests/unit/ || echo "Cannot list tests/unit directory" | |
fi | |
- name: Run Debian Tests | |
if: ${{ needs.changes.outputs.debian == 'true' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "Running Debian tests for environment: ${{ env.TEST_ENV }}" | |
if [ -f "tests/unit/test_debian_transformer.py" ]; then | |
pytest tests/unit/test_debian_transformer.py -v -m transformer --cov=core --cov-append --cov-report=xml --cov-report=term-missing || echo "Tests failed but continuing workflow" | |
else | |
echo "Warning: tests/unit/test_debian_transformer.py not found" | |
ls -la tests/unit/ || echo "Cannot list tests/unit directory" | |
fi | |
- name: Run Pkgx Tests | |
if: ${{ needs.changes.outputs.pkgx == 'true' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "Running Pkgx tests for environment: ${{ env.TEST_ENV }}" | |
if [ -f "tests/unit/test_pkgx_transformer.py" ]; then | |
pytest tests/unit/test_pkgx_transformer.py -v -m transformer --cov=core --cov-append --cov-report=xml --cov-report=term-missing || echo "Tests failed but continuing workflow" | |
else | |
echo "Warning: tests/unit/test_pkgx_transformer.py not found" | |
ls -la tests/unit/ || echo "Cannot list tests/unit directory" | |
fi | |
- name: Run System Tests | |
if: ${{ needs.changes.outputs.any_changes == 'true' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "Running system tests for environment: ${{ env.TEST_ENV }}" | |
if [ -d "tests/system" ]; then | |
pytest tests/system -v -m system --cov=core --cov-append --cov-report=xml --cov-report=term-missing || echo "Tests failed but continuing workflow" | |
else | |
echo "Warning: tests/system directory not found" | |
ls -la tests/ || echo "Cannot list tests directory" | |
fi |