Skip to content

Commit

Permalink
Merge branch 'main' into ECO-2195
Browse files Browse the repository at this point in the history
  • Loading branch information
CRBl69 committed Dec 3, 2024
2 parents 24b464b + ebe11b4 commit 0930163
Show file tree
Hide file tree
Showing 272 changed files with 7,276 additions and 2,809 deletions.
37 changes: 0 additions & 37 deletions .github/actions/ts-run-tests/action.yaml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/fallback-deploy.file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
jobs:
verify-fallback-deploy-file:
env:
FALLBACK_FILE: 'src/cloud-formation/deploy-indexer-fallback.yaml'
PRODUCTION_FILE: 'src/cloud-formation/deploy-indexer-production.yaml'
YQ_BASE_URL: 'https://github.com/mikefarah/yq/releases/download'
YQ_VERSION: 'v4.44.5'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
- name: 'Install yaml parsing tool'
run: |
YQ_BINARY="${YQ_BASE_URL}/${YQ_VERSION}/yq_linux_amd64"
sudo wget -O /usr/local/bin/yq "$YQ_BINARY"
sudo chmod +x /usr/local/bin/yq
- name: 'Verify fallback and production files same except `Environment`'
run: |
diff \
<(yq 'del(.parameters.Environment)' "$PRODUCTION_FILE") \
<(yq 'del(.parameters.Environment)' "$FALLBACK_FILE")
- name: 'Verify `Environment` in fallback and production files.'
run: |
PROD_ENV=$(yq '.parameters.Environment' "$PRODUCTION_FILE")
FALLBACK_ENV=$(yq '.parameters.Environment' "$FALLBACK_FILE")
[ "$PROD_ENV" = 'production' ] || exit 1
[ "$FALLBACK_ENV" = 'fallback' ] || exit 1
name: 'Verify fallback stack deployment file'
'on':
pull_request: null
push:
branches:
- 'main'
- 'fallback'
- 'production'
workflow_dispatch: null
...
36 changes: 16 additions & 20 deletions .github/workflows/frontend-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,42 @@ jobs:
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
submodules: 'false'
- uses: 'actions/setup-node@v4'
with:
node-version: 'lts/*'
node-version-file: 'src/typescript/.node-version'
- name: 'Install dependencies'
run: 'npm install -g pnpm && pnpm install'
- env:
GITHUB_ACCESS_TOKEN: '${{ secrets.TRADING_VIEW_REPO_ACCESS_TOKEN }}'
TRADING_VIEW_REPO_OWNER: '${{ secrets.TRADING_VIEW_REPO_OWNER }}'
name: 'Test'
run: 'echo -n $TRADING_VIEW_REPO_OWNER | wc -c'
- env:
GITHUB_ACCESS_TOKEN: '${{ secrets.TRADING_VIEW_REPO_ACCESS_TOKEN }}'
TRADING_VIEW_REPO_OWNER: '${{ secrets.TRADING_VIEW_REPO_OWNER }}'
name: 'Clone submodule'
run: 'pnpm run submodule'
- name: 'Run pnpm i'
run: 'pnpm i'
- name: 'Install Playwright Browsers'
run: 'pnpm run playwright:install'
- name: 'Copy env file'
run: 'cp ci.env .env'
- name: 'Copy docker env file'
run: 'cp ../docker/example.local.env ../docker/.env'
- name: 'Run Playwright tests'
run: 'pnpm run e2e:frontend'
- if: 'always()'
run: 'pnpm run test:frontend'
- if: '${{ failure() }}'
name: 'Upload screenshots as artifacts'
uses: 'actions/upload-artifact@v4'
with:
name: 'playwright-screenshots'
path: 'src/typescript/frontend/screenshots/'
- if: '${{ !cancelled() }}'
name: 'Upload Playwright report as artifact'
uses: 'actions/upload-artifact@v4'
with:
name: 'playwright-report'
path: 'playwright-report/'
path: 'src/typescript/frontend/playwright-report/'
retention-days: 30
timeout-minutes: 60
timeout-minutes: 15
name: 'Run the frontend tests'
"on":
pull_request:
branches:
- 'main'
- 'production'
pull_request: null
push:
branches:
- 'main'
- 'production'
workflow_dispatch: null
...
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
path: './src/python/hooks/.venv'
- uses: 'pre-commit/[email protected]'
with:
extra_args: '--all-files --config cfg/pre-commit-config.yaml --verbose'
extra_args: '--all-files --config cfg/pre-commit-config.yaml'
name: 'pre-commit'
'on':
pull_request: null
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/production-branch-protection.yaml

This file was deleted.

38 changes: 34 additions & 4 deletions .github/workflows/push-broker.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cspell:word imagetools
# cspell:word onlatest
---
jobs:
build-push:
Expand All @@ -11,25 +13,53 @@ jobs:
images: 'econialabs/emojicoin-dot-fun-indexer-broker'
tags: |
type=match,pattern=broker-v(.*),group=1
- id: 'arm64-metadata'
uses: 'docker/metadata-action@v5'
with:
flavor: |
suffix=-arm64,onlatest=true
images: 'econialabs/emojicoin-dot-fun-indexer-broker'
tags: |
type=match,pattern=broker-v(.*),group=1
- uses: 'docker/setup-qemu-action@v3'
- uses: 'docker/setup-buildx-action@v3'
- uses: 'docker/login-action@v3'
with:
password: '${{ secrets.DOCKERHUB_TOKEN }}'
username: '${{ secrets.DOCKERHUB_USERNAME }}'
- uses: 'docker/build-push-action@v6'
- name: 'Push AMD image to Docker Hub'
uses: 'docker/build-push-action@v6'
with:
build-args: 'FEATURES=ws'
cache-from: 'type=gha'
cache-to: 'type=gha,mode=max'
context: 'src/rust'
file: 'src/rust/broker/Dockerfile'
labels: '${{ steps.metadata.outputs.labels }}'
platforms: '${{ vars.DOCKER_IMAGE_PLATFORMS }}'
platforms: 'linux/amd64'
push: 'true'
tags: '${{ steps.metadata.outputs.tags }}'
- name: 'Clear Docker cache to free up space for ARM build'
run: 'docker system prune -af'
- name: 'Push ARM image to Docker Hub'
uses: 'docker/build-push-action@v6'
with:
build-args: 'FEATURES=ws'
cache-from: 'type=gha'
cache-to: 'type=gha,mode=max'
context: 'src/rust'
file: 'src/rust/broker/Dockerfile'
platforms: 'linux/arm64'
push: 'true'
tags: '${{ steps.arm64-metadata.outputs.tags }}'
- name: 'Append ARM images to AMD manifest'
run: |
echo "${{ steps.metadata.outputs.tags }}" | while read -r tag; do
if [ ! -z "$tag" ]; then
docker buildx imagetools create --append -t "$tag" "${tag}-arm64"
fi
done
timeout-minutes: 360
name: 'Build broker Docker image and push to Docker Hub'
name: 'Push multi-platform processor image to Docker Hub'
'on':
push:
tags:
Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/sdk-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
---
env:
NEXT_PUBLIC_MODULE_ADDRESS: >-
0xf000d910b99722d201c6cf88eb7d1112b43475b9765b118f289b5d65d919000d
PUBLISHER_PRIVATE_KEY: >-
0xeaa964d1353b075ac63b0c5a0c1e92aa93355be1402f6077581e37e2a846105e
TS_DIR: 'src/typescript'
jobs:
sdk-tests:
permissions:
contents: 'write'
defaults:
run:
working-directory: 'src/typescript'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
submodules: 'false'
- uses: 'actions/setup-node@v4'
with:
node-version-file: 'src/typescript/.node-version'
- name: 'Install dependencies'
run: 'npm install -g pnpm && pnpm install'
- name: 'Install the latest Aptos CLI'
# yamllint disable-line rule:line-length
uses: 'aptos-labs/aptos-core/.github/actions/get-latest-cli@8792eefecd537c33fb879984635a0762838e2329'
with:
destination_directory: '/usr/local/bin'
- uses: './.github/actions/ts-run-tests'
- env:
NEXT_PUBLIC_MODULE_ADDRESS: >-
0xf000d910b99722d201c6cf88eb7d1112b43475b9765b118f289b5d65d919000d
PUBLISHER_PRIVATE_KEY: >-
0xeaa964d1353b075ac63b0c5a0c1e92aa93355be1402f6077581e37e2a846105e
name: 'Run SDK tests'
run: 'pnpm run test:sdk'
- if: 'failure()'
name: 'Print local testnet logs on failure'
run: 'cat ${{ runner.temp }}/local-testnet-logs.txt'
shell: 'bash'
timeout-minutes: 15
name: 'Run the SDK tests'
'on':
pull_request: null
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
**/.env
**/.env*
**/.turbo
**/.vercel
80 changes: 78 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
The emojicoin dot fun Move package is audited:

- [PDF Report]
- Corresponding `git` tag [`move-v1.0.0-audited`]
- Corresponding `git` tag [`move-v1.0.1-audited`]

<!-- markdownlint-enable MD036 -->

Expand All @@ -27,6 +27,82 @@ The process is as simple as merging feature branches to `main` first to trigger
CI/CD checks, and then once it's merged into `main`, merging or [cherry-picking]
a subset of the new features into the `production` branch.

If you don't have a production branch yet, simply run the following:

1. `git checkout main && git pull origin main`
1. `git checkout -b production`
1. `git push origin production`

Now a production branch exists.

To merge new changes from `main` after `production` already exists, you can
create a PR that merges all new changes in `main` into `production`.

### Cherry-picking strategy

It's possible to preserve the linear history of `main` when merging into
`production` while still squashing the commits. This process looks like the
following:

```shell
# Make sure `main` is up to date in your local environment.
git checkout main && git pull origin main

# Do the same for `production`.
git checkout production && git pull origin production

# Create a branch to make a PR to cherry-pick new changes from main into
# production with.
git checkout -b merge-main-to-prod
```

Now find the last commit that `main` and `production` share. If the commit
history looks like this:

```yaml
- main:
- 06eadf3
- 05eacbd
- 04de8fb # Squashed into the last commit `ff382ba` in `production`.
- 03aebcd # Squashed into the last commit `ff382ba` in `production`.
- 02abde4 # Common ancestor.
- 01ebadc
- production:
- ff382ba # Commit that previously squashed `03..` + `04..` into `production`.
- 02abde4 # Common ancestor.
- 01ebadc
```
Then the last commit they share (the common ancestor) is `02abde4`.

Thus you should run:

```shell
# Cherry-pick all commits from `02abde4..06eadf3` into `production`.
git cherry-pick 02abde4..06eadf3

# Push to the new branch.
git push origin merge-main-to-prod
```

Now you can make a PR to merge main to production with the `merge-main-to-prod`
branch!

### `fallback` branch

The `fallback` branch is intended to follow the `production` branch by a commit
during indexer stack updates: whenever indexer stack changes merge to
`production`, frontend deployments can be temporarily pointed at the `fallback`
stack to prevent any downtime in the case of a `production` stack deployment
failure or for in-place stack upgrades that result temporary outages.

For the purposes of indexer stack management, `production` only *needs* to be
merged into `fallback` just before indexer changes land in `production`,
nevertheless it is best practice to merge from `production` into `fallback` on a
regular cadence.

### Environment variables

You can set in Vercel project settings the production branch. By default, this
is `main`, however you can use the `production` branch to separate staging
environments from the release (aka production) environment.
Expand Down Expand Up @@ -123,4 +199,4 @@ git submodule update --init --recursive
[pre-commit shield]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit
[uploading environment variables with vercel's ui]: https://github.com/user-attachments/assets/d613725d-82ed-4a4e-a467-a89b2cf57d91
[vercel cli]: https://vercel.com/docs/cli
[`move-v1.0.0-audited`]: https://github.com/econia-labs/emojicoin-dot-fun/releases/tag/move-v1.0.0-audited
[`move-v1.0.1-audited`]: https://github.com/econia-labs/emojicoin-dot-fun/releases/tag/move-v1.0.1-audited
Loading

0 comments on commit 0930163

Please sign in to comment.