Skip to content
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

Add link to github actions workflow in dst issue and use cache #185

Merged
merged 6 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,22 @@ jobs:
- name: Build resonate
run: go build -o resonate

- name: Upload resonate binary
uses: actions/upload-artifact@v4
- name: Cache resonate binary
uses: actions/cache/save@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}

test:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true

- name: Run resonate server
run: |
Expand Down Expand Up @@ -154,6 +156,7 @@ jobs:
with:
path: ./bin/linux-aarch64/resonate
destination: resonate-release/linux-aarch64

deploy-darwin-binary:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [build, test, scan]
Expand Down
86 changes: 57 additions & 29 deletions .github/workflows/dst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ 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: Upload resonate binary
uses: actions/upload-artifact@v4
- name: Cache resonate binary
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}

seed:
runs-on: ubuntu-latest
Expand All @@ -46,10 +55,12 @@ jobs:
timeout-minutes: 150

steps:
- name: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Run dst (seed=${{ needs.seed.outputs.seed }})
run: |
chmod +x resonate
Expand All @@ -65,7 +76,8 @@ jobs:
--reason "DST run failed for seed=${{ needs.seed.outputs.seed }} and store=sqlite." \
--file logs.txt \
--repo $GITHUB_REPOSITORY \
--commit $GITHUB_SHA
--commit $GITHUB_SHA \
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
Expand All @@ -77,10 +89,12 @@ jobs:
needs: [build, seed]
timeout-minutes: 150
steps:
- name: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Run dst (seed=${{ needs.seed.outputs.seed }})
run: |
chmod +x resonate
Expand Down Expand Up @@ -119,10 +133,12 @@ jobs:
- 5432:5432

steps:
- name: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Run dst (seed=${{ needs.seed.outputs.seed }})
run: |
chmod +x resonate
Expand All @@ -138,7 +154,8 @@ jobs:
--reason "DST run failed for seed=${{ needs.seed.outputs.seed }} and store=postgres." \
--file logs.txt \
--repo $GITHUB_REPOSITORY \
--commit $GITHUB_SHA
--commit $GITHUB_SHA \
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
Expand Down Expand Up @@ -173,10 +190,12 @@ jobs:
- 5432:5432

steps:
- name: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Run dst (seed=${{ needs.seed.outputs.seed }})
run: |
chmod +x resonate
Expand All @@ -191,10 +210,12 @@ jobs:
runs-on: ubuntu-latest
needs: [build, seed, dst-sqlite-1, dst-sqlite-2]
steps:
- name: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Download logs from run 1
uses: actions/download-artifact@v4
with:
Expand All @@ -219,16 +240,19 @@ jobs:
--store sqlite \
--reason "Two DST runs produced different results for seed=${{ needs.seed.outputs.seed }} and store=sqlite." \
--repo $GITHUB_REPOSITORY \
--commit $GITHUB_SHA
--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: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Download logs from run 1
uses: actions/download-artifact@v4
with:
Expand All @@ -253,16 +277,19 @@ jobs:
--store postgres \
--reason "Two DST runs produced different results for seed=${{ needs.seed.outputs.seed }} and store=postgres." \
--repo $GITHUB_REPOSITORY \
--commit $GITHUB_SHA
--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: Download resonate binary
uses: actions/download-artifact@v4
- name: Restore resonate binary
uses: actions/cache/restore@v3
with:
name: resonate
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Download logs from run 1
uses: actions/download-artifact@v4
with:
Expand All @@ -287,4 +314,5 @@ jobs:
--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
--commit $GITHUB_SHA \
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
release-linux-artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout repositoryclear
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go 1.21
uses: actions/setup-go@v5
Expand Down
6 changes: 5 additions & 1 deletion cmd/dst/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ go run ./... dst run --seed %d --aio-store %s
~~~
%s
~~~

[more details](%s)
`

func CreateDSTIssueCmd() *cobra.Command {
Expand All @@ -54,6 +56,7 @@ func CreateDSTIssueCmd() *cobra.Command {
file string
repo string
commit string
url string
)

cmd := &cobra.Command{
Expand All @@ -78,7 +81,7 @@ func CreateDSTIssueCmd() *cobra.Command {
// create github issue
issue := &Issue{
Title: fmt.Sprintf("DST: %d", seed),
Body: fmt.Sprintf(issueFmt, reason, seed, store, commit, seed, store, logs),
Body: fmt.Sprintf(issueFmt, reason, seed, store, commit, seed, store, logs, url),
}

return createGitHubIssue(repo, token, issue)
Expand All @@ -91,6 +94,7 @@ func CreateDSTIssueCmd() *cobra.Command {
cmd.Flags().StringVar(&file, "file", "", "dst logs file")
cmd.Flags().StringVar(&repo, "repo", "", "github repo")
cmd.Flags().StringVar(&commit, "commit", "", "git commit sha")
cmd.Flags().StringVar(&url, "url", "", "github action url")

return cmd
}
Expand Down