Feat/test release #2
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: Pull Request Validation | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| validate-commits: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Validate commit messages | |
| run: just validate-commits | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Run linting and formatting checks | |
| run: just check | |
| - name: Run tests | |
| run: just test | |
| release-preview: | |
| runs-on: ubuntu-latest | |
| needs: [validate-commits, lint-and-test] | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Detect packages with changes | |
| id: detect-changes | |
| run: | | |
| changes=$(just detect-changes) | |
| echo "changes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$changes" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| # Check if there are any changes | |
| if [ "$changes" = "[]" ] || [ -z "$changes" ]; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Preview changelog | |
| if: steps.detect-changes.outputs.has_changes == 'true' | |
| run: | | |
| echo "## 📦 Release Preview" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "This PR will trigger releases for the following packages:" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo '```json' >> $GITHUB_STEP_SUMMARY | |
| echo '${{ steps.detect-changes.outputs.changes }}' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Changelog Preview" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| just preview-changelog >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| - name: No release preview | |
| if: steps.detect-changes.outputs.has_changes == 'false' | |
| run: | | |
| echo "## 📦 Release Preview" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "ℹ️ This PR does not contain changes that would trigger a new release." >> $GITHUB_STEP_SUMMARY |