DST #340
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
name: DST | |
on: | |
workflow_dispatch: | |
inputs: | |
seed: | |
type: string | |
schedule: | |
- cron: '0 */4 * * *' # every 4 hours | |
permissions: | |
contents: read | |
issues: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- id: cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
- name: Checkout repository | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Build resonate | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: go build -o resonate | |
- name: Cache resonate binary | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
seed: | |
runs-on: ubuntu-latest | |
steps: | |
- id: seed | |
name: Set random seed | |
run: echo seed=$RANDOM >> $GITHUB_OUTPUT | |
outputs: | |
seed: ${{ inputs.seed || steps.seed.outputs.seed }} | |
dst-sqlite-1: | |
runs-on: ubuntu-latest | |
needs: [build, seed] | |
timeout-minutes: 150 | |
steps: | |
- name: Restore resonate binary | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Run dst (seed=${{ needs.seed.outputs.seed }}) | |
run: | | |
chmod +x resonate | |
./resonate dst run --seed ${{ needs.seed.outputs.seed }} --aio-store sqlite > logs.txt | |
- name: Create issue if dst failed | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
if: ${{ failure() }} | |
run: | | |
./resonate dst issue \ | |
--seed ${{ needs.seed.outputs.seed }} \ | |
--store sqlite \ | |
--reason "DST run failed for seed=${{ needs.seed.outputs.seed }} and store=sqlite." \ | |
--file logs.txt \ | |
--repo $GITHUB_REPOSITORY \ | |
--commit $GITHUB_SHA \ | |
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: sqlite-logs-1 | |
path: logs.txt | |
dst-sqlite-2: | |
runs-on: ubuntu-latest | |
needs: [build, seed] | |
timeout-minutes: 150 | |
steps: | |
- name: Restore resonate binary | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Run dst (seed=${{ needs.seed.outputs.seed }}) | |
run: | | |
chmod +x resonate | |
./resonate dst run --seed ${{ needs.seed.outputs.seed }} --aio-store sqlite > logs.txt | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: sqlite-logs-2 | |
path: logs.txt | |
dst-postgres-1: | |
runs-on: ubuntu-latest | |
needs: [build, seed] | |
timeout-minutes: 150 | |
env: | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_HOST: "localhost" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PORT: "5432" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_USERNAME: "username" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PASSWORD: "password" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_DATABASE: "resonate_dst" | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_USER: ${{ env.DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_USERNAME }} | |
POSTGRES_PASSWORD: ${{ env.DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ env.DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_DATABASE }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Restore resonate binary | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Run dst (seed=${{ needs.seed.outputs.seed }}) | |
run: | | |
chmod +x resonate | |
./resonate dst run --seed ${{ needs.seed.outputs.seed }} --aio-store postgres > logs.txt | |
- name: Create issue if dst failed | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
if: ${{ failure() }} | |
run: | | |
./resonate dst issue \ | |
--seed ${{ needs.seed.outputs.seed }} \ | |
--store postgres \ | |
--reason "DST run failed for seed=${{ needs.seed.outputs.seed }} and store=postgres." \ | |
--file logs.txt \ | |
--repo $GITHUB_REPOSITORY \ | |
--commit $GITHUB_SHA \ | |
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: postgres-logs-1 | |
path: logs.txt | |
dst-postgres-2: | |
runs-on: ubuntu-latest | |
needs: [build, seed] | |
timeout-minutes: 150 | |
env: | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_HOST: "localhost" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PORT: "5432" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_USERNAME: "username" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PASSWORD: "password" | |
DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_DATABASE: "resonate_dst" | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_USER: ${{ env.DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_USERNAME }} | |
POSTGRES_PASSWORD: ${{ env.DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ env.DST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_DATABASE }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Restore resonate binary | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Run dst (seed=${{ needs.seed.outputs.seed }}) | |
run: | | |
chmod +x resonate | |
./resonate dst run --seed ${{ needs.seed.outputs.seed }} --aio-store postgres > logs.txt | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: postgres-logs-2 | |
path: logs.txt | |
dst-sqlite-diff: | |
runs-on: ubuntu-latest | |
needs: [build, seed, dst-sqlite-1, dst-sqlite-2] | |
steps: | |
- name: Restore resonate binary | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Download logs from run 1 | |
uses: actions/download-artifact@v4 | |
with: | |
name: sqlite-logs-1 | |
path: logs-1.txt | |
- name: Download logs from run 2 | |
uses: actions/download-artifact@v4 | |
with: | |
name: sqlite-logs-2 | |
path: logs-2.txt | |
- name: Diff | |
run: | | |
diff logs-1.txt logs-2.txt | |
- name: Create issue if diff | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
if: ${{ failure() }} | |
run: | | |
chmod +x resonate | |
./resonate dst issue \ | |
--seed ${{ needs.seed.outputs.seed }} \ | |
--store sqlite \ | |
--reason "Two DST runs produced different results for seed=${{ needs.seed.outputs.seed }} and store=sqlite." \ | |
--repo $GITHUB_REPOSITORY \ | |
--commit $GITHUB_SHA \ | |
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | |
dst-postgres-diff: | |
runs-on: ubuntu-latest | |
needs: [build, seed, dst-postgres-1, dst-postgres-2] | |
steps: | |
- name: Restore resonate binary | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Download logs from run 1 | |
uses: actions/download-artifact@v4 | |
with: | |
name: postgres-logs-1 | |
path: logs-1.txt | |
- name: Download logs from run 2 | |
uses: actions/download-artifact@v4 | |
with: | |
name: postgres-logs-2 | |
path: logs-2.txt | |
- name: Diff | |
run: | | |
diff logs-1.txt logs-2.txt | |
- name: Create issue if diff | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
if: ${{ failure() }} | |
run: | | |
chmod +x resonate | |
./resonate dst issue \ | |
--seed ${{ needs.seed.outputs.seed }} \ | |
--store postgres \ | |
--reason "Two DST runs produced different results for seed=${{ needs.seed.outputs.seed }} and store=postgres." \ | |
--repo $GITHUB_REPOSITORY \ | |
--commit $GITHUB_SHA \ | |
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | |
dst-sqlite-postgres-diff: | |
runs-on: ubuntu-latest | |
needs: [build, seed, dst-sqlite-1, dst-postgres-1] | |
steps: | |
- name: Restore resonate binary | |
uses: actions/cache/restore@v3 | |
with: | |
path: resonate | |
key: resonate-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Download logs from run 1 | |
uses: actions/download-artifact@v4 | |
with: | |
name: sqlite-logs-1 | |
path: logs-1.txt | |
- name: Download logs from run 2 | |
uses: actions/download-artifact@v4 | |
with: | |
name: postgres-logs-1 | |
path: logs-2.txt | |
- name: Diff | |
run: | | |
diff logs-1.txt logs-2.txt | |
- name: Create issue if diff | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
if: ${{ failure() }} | |
run: | | |
chmod +x resonate | |
./resonate dst issue \ | |
--seed ${{ needs.seed.outputs.seed }} \ | |
--store sqlite/postgres \ | |
--reason "Two DST runs produced different results for seed=${{ needs.seed.outputs.seed }} and store=sqlite/postgres." \ | |
--repo $GITHUB_REPOSITORY \ | |
--commit $GITHUB_SHA \ | |
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID |