diff --git a/.github/workflows/cache-dependencies.yml b/.github/workflows/cache-dependencies.yml new file mode 100644 index 00000000..ed5507d7 --- /dev/null +++ b/.github/workflows/cache-dependencies.yml @@ -0,0 +1,49 @@ +name: Build uv cache + +permissions: + contents: read + +on: + push: + branches: + - main + paths: + - "uv.lock" + - "**/pyproject.toml" + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +jobs: + build-cache: + name: build cache on ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7 + with: + python-version: ${{ matrix.python-version }} + enable-cache: false + + - name: Install dependencies and populate cache + run: | + echo "Building global UV cache..." + uv sync --all-packages --all-extras + echo "Cache populated successfully" + + - name: Save uv caches + uses: actions/cache/save@v4 + with: + path: | + ~/.cache/uv + ~/.local/share/uv + .venv + key: uv-main-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }} \ No newline at end of file diff --git a/.github/workflows/check-pypi-release.yml b/.github/workflows/check-pypi-release.yml new file mode 100644 index 00000000..6df2c97c --- /dev/null +++ b/.github/workflows/check-pypi-release.yml @@ -0,0 +1,44 @@ +name: Check Latest Pypi Release + +on: + workflow_dispatch: + inputs: + release-version: + type: string + description: Choose which release tag to test (no leading v) + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + sparse-checkout: | + tests/integration_tests/dbt_projects/project1 + tests/integration_tests/package_upgrades/mixed_versions + sparse-checkout-cone-mode: false + + - name: Install uv + uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7 + + - name: Create new uv project + run: uv init + + - name: Install specified release + run: uv add dbt-autofix==${{ inputs.release-version }} + + - name: Display uv dependencies + run: uv tree + + - name: Check version + run: uv run dbt-autofix --version + + - name: Test deprecations + run: uv run dbt-autofix deprecations --all --path tests/integration_tests/dbt_projects/project1 + + - name: Test package upgrade + run: uv run dbt-autofix packages --force-upgrade --path tests/integration_tests/package_upgrades/mixed_versions \ No newline at end of file diff --git a/.github/workflows/nox-pr.yml b/.github/workflows/nox-pr.yml index 264ce36d..7a1038d1 100644 --- a/.github/workflows/nox-pr.yml +++ b/.github/workflows/nox-pr.yml @@ -10,6 +10,6 @@ jobs: steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4 - name: Install uv - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7 - uses: fjwillemsen/setup-nox2@fc5420448a3f1145b0128f86b1837e82841684a4 # fjwillemsen/setup-nox2@v3.0.0 - run: nox diff --git a/.github/workflows/pytest-pr.yml b/.github/workflows/pytest-pr.yml index ad28bfc4..cec04b01 100644 --- a/.github/workflows/pytest-pr.yml +++ b/.github/workflows/pytest-pr.yml @@ -20,14 +20,35 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 + - name: Restore global uv cache + id: cache-restore + uses: actions/cache/restore@v4 + with: + path: | + ~/.cache/uv + ~/.local/share/uv + .venv + key: uv-main-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }} + restore-keys: | + uv-main-${{ matrix.python-version }}- + + - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7 with: python-version: ${{ matrix.python-version }} - enable-cache: true - cache-suffix: test + enable-cache: false - run: uv sync --all-extras --all-packages - run: uv run pytest + + - name: Save uv caches + if: steps.cache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + ~/.cache/uv + ~/.local/share/uv + .venv + key: uv-main-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }} lint: name: lint @@ -35,10 +56,11 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 + - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7 with: python-version: "3.10" enable-cache: true cache-suffix: lint - run: uv tool run ruff@0.14.14 check . --config pyproject.toml - - run: uv tool run ruff@0.14.14 format --check --diff . --config pyproject.toml \ No newline at end of file + - run: uv tool run ruff@0.14.14 format --check --diff . --config pyproject.toml + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index beda35d1..9f987d64 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7 - name: Build artifacts run: uv build --all diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml index b83b0b97..8c46366d 100644 --- a/.github/workflows/schedule.yml +++ b/.github/workflows/schedule.yml @@ -4,13 +4,16 @@ on: schedule: - cron: '0 * * * *' +permissions: + contents: read + jobs: nox: runs-on: ubuntu-latest steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4 - name: Install uv - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7 - uses: fjwillemsen/setup-nox2@fc5420448a3f1145b0128f86b1837e82841684a4 # fjwillemsen/setup-nox2@v3.0.0 - run: nox --session check_latest_schema-3.13 - run: uv sync --all-extras --all-packages --python 3.13