Skip to content

Commit

Permalink
Merge pull request #3117 from synapsecns/master
Browse files Browse the repository at this point in the history
FE Release 2024-09-10
  • Loading branch information
abtestingalpha authored Sep 10, 2024
2 parents 8b00fab + a240292 commit 741fc06
Show file tree
Hide file tree
Showing 327 changed files with 11,923 additions and 5,224 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
cancel_others: 'true'

# changes allows us to only run a job on changed packages

changes:
name: Change Detection
runs-on: ubuntu-latest
Expand All @@ -37,6 +37,8 @@ jobs:
packages_nodeps: ${{ steps.filter_go.outputs.changed_modules }}
package_count_nodeps: ${{ steps.length.outputs.FILTER_LENGTH_NODEPS }}
solidity_changes: ${{ steps.filter_solidity.outputs.any_changed }}
golangci_changed: ${{ steps.golangci_changed.outputs.any_changed }}
all_packages: ${{ steps.filter_go.outputs.all_modules }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -55,11 +57,28 @@ jobs:
with:
files: |
**/*.sol
- name: Check For GolangCI Changes
id: golangci_changed
uses: tj-actions/changed-files@v26.1
with:
# note: without building a yaml tree of our workflow, we won't be able to tell if golangci version changed so any ci change triggers full lint.
files: |
.golangci.yml
.github/workflows/go.yml
- name: Run step if any of the listed files above change
if: steps.filter_solidity.outputs.any_changed == 'true'
run: |
echo "One or more files listed above has changed."
- name: Golangci changed
if: steps.golangci_changed.outputs.any_changed == 'true'
run: |
echo "Golangci has changed."
- id: length
run: |
export FILTER_LENGTH_DEPS=$(echo $FILTERED_PATHS_DEPS | jq '. | length')
Expand Down Expand Up @@ -255,7 +274,7 @@ jobs:
build:
name: Build
needs: changes
runs-on: ${{ matrix.platform }}
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.package_count_deps > 0 && github.event_name != 'pull_request' }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -298,18 +317,16 @@ jobs:
name: Lint
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.package_count_deps > 0 && (github.event_name != 'push' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) }}
if: ${{ (needs.changes.outputs.package_count_deps > 0 || needs.changes.outputs.golangci_changed == 'true') && (github.event_name != 'push' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) }}
strategy:
fail-fast: false
max-parallel: 8
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['package1', 'package2'] if both package folders contains changes
package: ${{ fromJSON(needs.changes.outputs.packages_nodeps) }}
package: ${{ needs.changes.outputs.golangci_changed == 'true' && fromJSON(needs.changes.outputs.all_packages) || fromJSON(needs.changes.outputs.packages_nodeps) }}
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x

- uses: actions/checkout@v4
with:
Expand All @@ -324,15 +341,14 @@ jobs:
with:
working-directory: ${{matrix.package}}/
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.56.2
version: v1.60.3
# see: https://github.com/golangci/golangci-lint/issues/2654
args: --timeout=60m
env:
# GitHub token for annotations (optional)
GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT || secrets.GITHUB_TOKEN }}
GOMEMLIMIT: 6GiB
GOGC: -1

pr_metadata:
# this is needed to prevent us from hitting the github api rate limit
name: Get PR Metadata
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/goreleaser-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ jobs:
env:
FILTERED_PATHS: ${{ steps.filter_go.outputs.changed_modules_deps }}

# TODO: we may want to dry run this on prs
run-goreleaser:
runs-on:
- namespace-profile-fast-goreleaser
Expand Down
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ issues:
linters:
- revive
- stylecheck
- dupl
# wrapping errors when exporting for testing is tedious
- path: export_test\.go
linters:
Expand Down Expand Up @@ -145,4 +146,4 @@ issues:
- staticcheck
- wrapcheck
exclude-use-default: false
new-from-rev: a9a6f84f0569de877d06a027257aeca266aeda49
new-from-rev: 9fe0f033b73acf6b8240f0a832c4b4d21e68181b
10 changes: 7 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"editor.fontLigatures": "'calt', 'liga', 'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'ss08', 'ss09'",
// "editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
Expand All @@ -21,5 +20,10 @@
"solidity.packageDefaultDependenciesDirectory": "lib",
"solidity.compileUsingRemoteVersion": "v0.8.17+commit.8df45f5f",
"solidity.formatter": "prettier",
"solidity.defaultCompiler": "remote"
}
"solidity.defaultCompiler": "remote",
"tailwindCSS.classAttributes": [
".*class.*",
".*Class.*",
".*Properties.*",
]
}
57 changes: 55 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,57 @@

Contributions should roughly follow the [uber style guide](https://github.com/uber-go/guide/blob/master/style.md)

# Submitting a PR

When preparing to submit a pull request, there are a few key points to keep in mind to ensure a smooth review process and maintain the quality of our codebase.

First and foremost, we encourage you to use the default PR template provided in the repository. This template is designed to capture all the necessary information about your changes, making it easier for reviewers to understand the context and purpose of your work.

If your PR is related to a specific task in Notion, it's helpful to include the Notion ID in your PR title or description. For example, you might use a format like [SLT-143] at the end of your PR title. This allows us to easily track the relationship between tasks and code changes. **Note: It's important to include the Notion ID at the end, as if its put at the beginning it will be interpreted as semantic versioning and corrupt the changelog**.

![Example](./assets/notion-example.png)

During the review process, you might notice comments about code coverage changes. While we generally aim to maintain or improve code coverage, don't be overly concerned if you see minor fluctuations. If the coverage changes aren't material to the core functionality you're modifying, it's usually fine to proceed.

You'll likely encounter suggestions from CodeRabbit, our automated code review tool. While CodeRabbit can provide valuable insights, remember that it's an AI tool and may not always understand the full context of your changes. Use its suggestions as a starting point for improvement, but don't feel obligated to implement every recommendation it makes. Your judgment as a developer is crucial in determining which suggestions are truly beneficial.

If your PR gets labeled with `needs-go-generate`, don't worry - this is an easy fix. Simply run `go generate ./...` in your terminal, commit the changes, and push. This will update any auto-generated code that might be out of sync.

Similarly, if you see a `needs-yarn-lock` label, it means your changes have affected the project's dependencies. To resolve this, navigate to the root directory of the project and run `yarn`. This will update the yarn.lock file, ensuring that all developers are working with the same dependency versions.

Remember, these guidelines are here to help streamline our development process and maintain consistency across the project. We appreciate your contributions and look forward to reviewing your PRs!



## Carefully Reviewing PRs

Before merging a pull request, it's crucial to carefully review the changes. Here are some key points to consider:

1. Code quality: Ensure the code follows our style guide and best practices.
2. Functionality: Verify that the changes work as intended and don't introduce new bugs.
3. Tests: Check that appropriate tests have been added or updated.
4. Documentation: Confirm that any necessary documentation updates have been made.
5. Performance: Consider the impact on performance, especially for critical paths.

Take your time during the review process. It's better to have a thorough review than to rush and potentially introduce issues.

## Using Squash and Merge

When it's time to merge a PR, we prefer using the "Squash and Merge" option instead of rebasing. This approach combines all commits from the feature branch into a single commit in the main branch, which helps keep our commit history clean and easier to navigate.

Here's how to use the "Squash and Merge" option:

1. Once the PR is approved and ready to merge, click on the "Squash and merge" button in the GitHub interface.
2. Review the commit message. It will be pre-filled with the PR title and description, but you can edit it if needed.
3. Click "Confirm squash and merge".

![Squash and Merge Example](./assets/merge-example.png)

By using "Squash and Merge", we maintain a linear and clean history in our main branch, making it easier to understand the progression of our project and to revert changes if necessary.




<!-- todo: more-->

## Adding a new JS/TS Package
Expand All @@ -16,11 +67,13 @@ If you need to make a new JS/TS package, here are the steps to follow:
- If the package is a library that you'd like to publish, simply set the `private` field in `package.json` to `false` and the `publishConfig` access to public.
- If the package is a UI, please see [here](./.github/workflows/ui-preview.md) for instructions on configuring vercel. Make sure to update the paths there as well.

# Go

## Linting

Linting for go is used using [golangci-lint](https://golangci-lint.run/) at the latest released version. Please upgrade or install using your package manager. and run `make lint` from your desired module.

# Adding a new Go Module
## Adding a new Go Module

If you need to make a new go module, here are the steps to follow:

Expand Down Expand Up @@ -286,6 +339,6 @@ func TestEventDBSuite(t *testing.T) {

```

## Github Actions
# Github Actions

If you want to do a shallow clone, use `fetch-depth: 2` rather than `fetch-depth: 1`. This allows [some actions](https://docs.codecov.com/docs/environment-specific-requirements) (though not all of them) to determine the correct sha.
20 changes: 10 additions & 10 deletions agents/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
golang.org/x/sync v0.7.0
golang.org/x/sync v0.8.0
google.golang.org/grpc v1.64.0
gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/mysql v1.5.6
Expand Down Expand Up @@ -239,7 +239,7 @@ require (
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/mattn/go-tty v0.0.3 // indirect
github.com/miguelmota/go-ethereum-hdwallet v0.1.1 // indirect
Expand Down Expand Up @@ -318,17 +318,17 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/image v0.6.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/api v0.183.0 // indirect
google.golang.org/genproto v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/protobuf v1.34.2 // indirect
Expand Down
Loading

0 comments on commit 741fc06

Please sign in to comment.