-
Notifications
You must be signed in to change notification settings - Fork 2
Adding tests to postgres images project #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
moizpgedge
merged 1 commit into
main
from
Feat/PLAT-362/Adding-tests-to-postgres-images-project
Jan 12, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| name: PR Test Latest Images | ||
|
|
||
| # This workflow runs on pull requests and tests the latest images | ||
| # from the internal repository to ensure they still work with any changes. | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: read | ||
|
|
||
| env: | ||
| IMAGE_REGISTRY: ghcr.io/pgedge | ||
| PACKAGE_REPOSITORY: pgedge-postgres-internal | ||
|
|
||
| jobs: | ||
| # Get latest tags and generate test matrix | ||
| setup: | ||
| # Skip for forked PRs since they won't have access to internal packages | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.generate.outputs.matrix }} | ||
| tags: ${{ steps.get-tags.outputs.tags }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
|
|
||
| - name: Get latest tags | ||
| id: get-tags | ||
| run: | | ||
| set -e | ||
| TAGS=$(make latest-tags) | ||
|
|
||
| # Validate that tags were retrieved successfully | ||
| if [ -z "$TAGS" ]; then | ||
| echo "Error: Failed to retrieve latest tags. make latest-tags returned empty output." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "tags=$TAGS" >> $GITHUB_OUTPUT | ||
| echo "Latest tags: $TAGS" | ||
|
|
||
| - name: Generate test matrix | ||
| id: generate | ||
| run: | | ||
| # Parse tags from make output | ||
| TAGS="${{ steps.get-tags.outputs.tags }}" | ||
| IFS=',' read -ra TAG_ARRAY <<< "$TAGS" | ||
|
|
||
| # Test on both architectures | ||
| ARCHS=("x86" "arm") | ||
|
|
||
| # Build matrix JSON | ||
| matrix_items="" | ||
| for tag in "${TAG_ARRAY[@]}"; do | ||
| tag=$(echo "$tag" | xargs) # trim whitespace | ||
|
|
||
| # Determine flavor from tag | ||
| if [[ "$tag" == *"-minimal"* ]]; then | ||
| flavor="minimal" | ||
| elif [[ "$tag" == *"-standard"* ]]; then | ||
| flavor="standard" | ||
| else | ||
| # Default to standard if not specified | ||
| flavor="standard" | ||
| fi | ||
|
|
||
| for arch in "${ARCHS[@]}"; do | ||
| arch=$(echo "$arch" | xargs) # trim whitespace | ||
|
|
||
| # Map user-friendly arch names to runner names | ||
| if [[ "$arch" == "arm" ]] || [[ "$arch" == "arm64" ]]; then | ||
| runner="ubuntu-24.04-arm" | ||
| arch_display="arm" | ||
| elif [[ "$arch" == "x86" ]] || [[ "$arch" == "amd64" ]]; then | ||
| runner="ubuntu-latest" | ||
| arch_display="x86" | ||
| else | ||
| echo "Error: Unknown architecture '$arch'. Use 'x86' or 'arm'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ -n "$matrix_items" ]]; then | ||
| matrix_items+="," | ||
| fi | ||
| matrix_items+="{\"tag\":\"$tag\",\"arch\":\"$arch_display\",\"flavor\":\"$flavor\",\"runner\":\"$runner\"}" | ||
| done | ||
| done | ||
|
|
||
| echo "matrix={\"include\":[$matrix_items]}" >> $GITHUB_OUTPUT | ||
| echo "Generated matrix: {\"include\":[$matrix_items]}" | ||
|
|
||
| test: | ||
| # Skip for forked PRs since they won't have access to internal packages | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| needs: setup | ||
| runs-on: ${{ matrix.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.23' | ||
| cache-dependency-path: tests/go.sum | ||
|
|
||
| - name: Pull image | ||
| run: | | ||
| IMAGE="${{ env.IMAGE_REGISTRY }}/${{ env.PACKAGE_REPOSITORY }}:${{ matrix.tag }}" | ||
| echo "Pulling image: $IMAGE" | ||
| docker pull "$IMAGE" | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| IMAGE="${{ env.IMAGE_REGISTRY }}/${{ env.PACKAGE_REPOSITORY }}:${{ matrix.tag }}" | ||
| make test-image IMAGE="$IMAGE" FLAVOR="${{ matrix.flavor }}" | ||
|
|
||
| results: | ||
| # Skip for forked PRs since they won't have access to internal packages | ||
| # Also use always() to ensure results are shown even if test job fails | ||
| if: github.event.pull_request.head.repo.full_name == github.repository && always() | ||
| needs: [setup, test] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Output | ||
| run: | | ||
| echo "## Test Results" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Input | Value |" >> $GITHUB_STEP_SUMMARY | ||
| echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Package Repository | ${{ env.PACKAGE_REPOSITORY }} |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Tags | ${{ needs.setup.outputs.tags }} |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Architectures | x86,arm |" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| if [[ "${{ needs.test.result }}" == "success" ]]; then | ||
| echo "✅ **All tests passed!**" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "❌ **Some tests failed.** Check the job logs for details." >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.