-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c5c7f6
commit 84c5dd4
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains 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,72 @@ | ||
name: Run Test Suite | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
export_variables: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
primary_image: ${{ steps.compute_container_registry_name.outputs.CR_NAME }}/postgres_primary:${{ steps.calculate_primary_sha.outputs.PRIMARY_SHA }} | ||
replica_image: ${{ steps.compute_container_registry_name.outputs.CR_NAME }}/postgres_replica:${{ steps.calculate_replica_sha.outputs.REPLICA_SHA }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Compute container registry name | ||
id: compute_container_registry_name | ||
run: echo "CR_NAME=$(echo ghcr.io/${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | ||
|
||
- name: Calculate SHA256 for postgres_primary.dockerfile | ||
id: calculate_primary_sha | ||
run: echo "PRIMARY_SHA=$(sha256sum postgres_primary.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT | ||
|
||
- name: Calculate SHA256 for postgres_replica.dockerfile | ||
id: calculate_replica_sha | ||
run: echo "REPLICA_SHA=$(sha256sum postgres_replica.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT | ||
|
||
prebuild_primary: | ||
needs: export_variables | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and tag primary Docker image | ||
run: docker build -f postgres_primary.dockerfile -t ${{ needs.export_variables.outputs.primary_image }} . | ||
|
||
- name: Push primary Docker image | ||
run: docker push ${{ needs.export_variables.outputs.primary_image }} | ||
|
||
prebuild_replica: | ||
needs: export_variables | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and tag replica Docker image | ||
run: docker build -f postgres_replica.dockerfile -t ${{ needs.export_variables.outputs.replica_image }} . | ||
|
||
- name: Push replica Docker image | ||
run: docker push ${{ needs.export_variables.outputs.replica_image }} |