name: Perform Checks on PR on: pull_request: merge_group: jobs: tidy-pr: name: Tidy PR if: github.event_name == 'pull_request' permissions: contents: write # for TimonVS/pr-labeler-action to read config file pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Required to fetch all history for merging - name: Update PR with master run: | git config user.name github-actions git config user.email github-actions@github.com git fetch origin master git merge origin/master --no-edit git push - uses: TimonVS/pr-labeler-action@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value - name: AI PR Body Generator uses: jbrocher/auto-pr-body-generator@v0.2.2 with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} test-builds: if: github.event_name == 'pull_request' runs-on: ubuntu-latest name: Run Build Tests steps: - name: Checkout repository uses: actions/checkout@v4 with: repository: onsonr/sonr fetch-depth: 0 fetch-tags: true - uses: actions/setup-go@v5 with: go-version: "1.23" check-latest: true - name: Run Sonrd Build run: make build - name: Run Hway Build run: make build-hway - name: Run Motr Build run: make build-motr test-unit: if: github.event_name == 'pull_request' runs-on: ubuntu-latest name: Run Unit Tests steps: - name: Checkout repository uses: actions/checkout@v4 with: repository: onsonr/sonr fetch-depth: 0 fetch-tags: true - uses: actions/setup-go@v5 with: go-version: "1.23" check-latest: true - run: make test-unit test-race: runs-on: ubuntu-latest if: github.event_name == 'merge_group' name: Run Race Tests continue-on-error: true steps: - name: Checkout repository uses: actions/checkout@v4 with: repository: onsonr/sonr fetch-depth: 0 fetch-tags: true - uses: actions/setup-go@v5 with: go-version: "1.23" check-latest: true - run: make test-race test-cover: runs-on: ubuntu-latest if: github.event_name == 'merge_group' name: Run Coverage Tests steps: - name: Checkout repository uses: actions/checkout@v4 with: repository: onsonr/sonr fetch-depth: 0 fetch-tags: true - uses: actions/setup-go@v5 with: go-version: "1.23" check-latest: true - run: make test-cover validate-release: if: github.event_name == 'merge_group' runs-on: ubuntu-latest name: Verify Release Config steps: - name: Checkout repository uses: actions/checkout@v4 with: repository: onsonr/sonr fetch-depth: 0 fetch-tags: true - uses: actions/setup-go@v5 with: go-version: "1.23" check-latest: true - name: Commitizen Dry Run uses: commitizen-tools/commitizen-action@master with: push: false dry_run: true github_token: ${{ secrets.GITHUB_TOKEN }} branch: main - name: Check GoReleaser Config uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: latest args: check env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: GoReleaser Dry Run uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: latest args: release --snapshot --clean --skip=publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}