Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into rs-test-coinflow
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson committed Dec 4, 2023
2 parents 902eef5 + 942fcb8 commit 7d92b1d
Show file tree
Hide file tree
Showing 833 changed files with 87,859 additions and 13,955 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- ./packages/common/node_modules
- ./packages/libs/node_modules
- ./packages/identity-service/node_modules
- ./packages/discovery-provider/es-indexer/node_modules

generate-release-branch:
working_directory: ~/audius-protocol
Expand Down Expand Up @@ -360,13 +361,15 @@ workflows:
packages/identity-service/.* run-integration-workflow true
eth-contracts/.* run-eth-contracts-workflow true
monitoring/healthz/.* run-healthz-workflow true
monitoring/uptime/node-ui/.* run-d-ui-workflow true
protocol-dashboard/.* run-protocol-dashboard-workflow true
contracts/.* run-contracts-workflow true
.circleci/.* run-discovery-workflow true
.circleci/.* run-creator-workflow true
.circleci/.* run-identity-workflow true
.circleci/.* run-eth-contracts-workflow true
.circleci/.* run-protocol-dashboard-workflow true
.circleci/.* run-d-ui-workflow true
.circleci/.* run-healthz-workflow true
.circleci/.* run-contracts-workflow true
.circleci/.* run-sdk-workflow true
Expand Down Expand Up @@ -437,7 +440,9 @@ workflows:
packages/harmony/.* run-mobile-workflow true
packages/mobile/.* run-mobile-workflow true
packages/web/.* run-web-workflow true
packages/embed/.* run-embed-workflow true
protocol-dashboard/.* run-protocol-dashboard-workflow true
monitoring/uptime/node-ui/.* run-d-ui-workflow true
monitoring/healthz/.* run-healthz-workflow true
requires:
- generate-config
Expand Down
3 changes: 3 additions & 0 deletions .circleci/src/@continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ parameters:
run-protocol-dashboard-workflow:
type: boolean
default: false
run-d-ui-workflow:
type: boolean
default: false
run-healthz-workflow:
type: boolean
default: false
Expand Down
62 changes: 45 additions & 17 deletions .circleci/src/commands/@mobile-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ mobile-prepare-ios:
key: 1-gems-{{ checksum "packages/mobile/ios/Gemfile.lock" }}
paths:
- packages/mobile/ios/vendor/bundle
- run:
name: Symlink react-native
command: |
ln -s $PWD/node_modules/.bin/react-native $PWD/packages/mobile/node_modules/.bin/react-native || true
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
- restore_cache:
key: pods-{{ checksum "packages/mobile/ios/Podfile.lock" }}
- run:
Expand Down Expand Up @@ -116,16 +121,20 @@ mobile-release-ios:
deploying_version=$(jq -r '.version' package.json)
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment=<<parameters.bundle-id>>
if [ "$environment" = 'co.audius.audiusmusic' ] ||
[ "$environment" = 'co.audius.audiusmusic.releasecandidate' ] ||
[ "$environment" = 'co.audius.audiusmusic.staging.releasecandidate' ]; then
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile ios \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile ios \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
fi
# Prepare to build/upload/release Android
mobile-prepare-android:
Expand Down Expand Up @@ -192,6 +201,10 @@ mobile-build-android:
command: |
cd packages/mobile/android
bundle exec fastlane incrementVersionCode package_name:<<parameters.bundle-id>> track:<<parameters.track>>
- run:
name: Symlink react-native
command: |
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
- run:
name: generating the release apk & bundle
command: |
Expand All @@ -211,6 +224,11 @@ mobile-release-android:
default: 'alpha'
type: string
steps:
- run:
name: Symlink react-native
command: |
ln -s $PWD/node_modules/.bin/react-native $PWD/packages/mobile/node_modules/.bin/react-native || true
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
- run:
name: release android
command: |
Expand All @@ -221,18 +239,23 @@ mobile-release-android:
command: |
cd packages/mobile
deploying_version=$(jq -r '.version' package.json)
environment=<<parameters.upload-type>>
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment=<<parameters.upload-type>>
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile android \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
if [ "$environment" = 'prod' ] ||
[ "$environment" = 'releaseCandidate' ] ||
[ "$environment" = 'stagingReleaseCandidate' ]; then
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile android \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
fi
# Deploy Solana saga dApp store
mobile-release-saga-dapp-store:
Expand Down Expand Up @@ -273,6 +296,11 @@ mobile-release-saga-dapp-store:
command: |
cd packages/mobile/android
bundle exec fastlane incrementVersionCode package_name:<<parameters.bundle-id>> track:<<parameters.track>>
- run:
name: Symlink react-native
command: |
ln -s $PWD/node_modules/.bin/react-native $PWD/packages/mobile/node_modules/.bin/react-native || true
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
- run:
name: Build Android
command: |
Expand Down
42 changes: 22 additions & 20 deletions .circleci/src/commands/@web-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,20 @@ web-distribute:
command: |
cd packages/web
deploying_version=$(jq -r '.version' package.json)
environment="<< parameters.environment >>"
os="<< parameters.os >>"
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment="<< parameters.environment >>"
if [ "$environment" = 'production' ]; then
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to desktop $os \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to desktop $os \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
fi
web-install-wrangler:
steps:
Expand Down Expand Up @@ -203,18 +204,19 @@ web-deploy-cloudflare:
command: |
cd packages/web
deploying_version=$(jq -r '.version' package.json)
environment="<< parameters.environment >>"
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment="<< parameters.environment >>"
if [ "$environment" = 'production' ]; then
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to web \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to web \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
fi
web-deploy-sourcemaps-s3:
steps:
Expand Down
40 changes: 40 additions & 0 deletions .circleci/src/jobs/@d-ui-jobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
d-ui-init:
working_directory: ~/audius-protocol
docker:
- image: cimg/ruby:2.6-node

steps:
- checkout

- run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > monitoring/uptime/node-ui/.npmrc

# Download and cache dependencies
- restore_cache:
keys:
- dependency-cache-{{ checksum "monitoring/uptime/node-ui/package.json" }}
# fallback to using the latest cache if no exact match is found
- dependency-cache-

- run:
name: npm ci
command: |
cd monitoring/uptime/node-ui
npm ci
- save_cache:
key: dependency-cache-{{ checksum "monitoring/uptime/node-ui/package.json" }}
paths:
- monitoring/uptime/node-ui/node_modules

# Lint
- run:
name: lint
command: |
cd monitoring/uptime/node-ui
npm run lint
# Persist node modules
- persist_to_workspace:
root: ./
paths:
- monitoring/uptime/node-ui/node_modules
16 changes: 16 additions & 0 deletions .circleci/src/jobs/@discovery-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ lint-discovery-provider:
steps:
- checkout

- attach_workspace:
at: ./

- create_concatenated_patch_file:
filename: combined-patch-file.txt

- restore_cache:
keys:
- cache-{{ checksum "package-lock.json" }}-{{ checksum "combined-patch-file.txt" }}

- restore_cache:
key: python-requirements-{{ checksum "packages/discovery-provider/requirements.txt" }}

Expand Down Expand Up @@ -35,6 +45,12 @@ lint-discovery-provider:
cd packages/discovery-provider
mypy .
- persist_to_workspace:
root: ./
paths:
- node_modules
- packages/discovery-provider/es-indexer/node_modules

test-discovery-api:
working_directory: ~/audius-protocol
executor: newman/postman-newman-docker
Expand Down
8 changes: 5 additions & 3 deletions .circleci/src/jobs/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
parameters:
service:
description: "Service to test"
description: 'Service to test'
type: string
machine: true
resource_class: audiusproject/gcp-n2-standard-4
working_directory: ~/audius-protocol
steps:
- checkout:
path: '~/audius-protocol'
- checkout
- attach_workspace:
at: ./
- run: AUDIUS_DEV=false bash ~/audius-protocol/dev-tools/setup.sh
- run:
name: test run "<< parameters.service >>"
Expand Down
3 changes: 3 additions & 0 deletions .circleci/src/workflows/d-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
when: << pipeline.parameters.run-d-ui-workflow >>
jobs:
- d-ui-init
13 changes: 13 additions & 0 deletions .circleci/src/workflows/discovery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ jobs:
requires:
- push-healthz

- push-arm-image:
name: push-uptime-arm
context: [Vercel, dockerhub]
service: uptime
filters:
branches:
only: main
requires:
- push-uptime


# Deploy audius-protocol `main` branch (stage)
- deploy-stage-nodes:
name: deploy-stage-discovery-provider
Expand All @@ -192,6 +203,7 @@ jobs:
- push-comms
- push-trpc
- push-protocol-dashboard
- push-uptime
- push-healthz
# uncomment when arm builds are stable
# - push-discovery-provider-arm
Expand All @@ -203,6 +215,7 @@ jobs:
# - push-trpc-arm
# - push-protocol-dashboard-arm
# - push-healthz-arm
# - push-uptime-arm

filters:
branches:
Expand Down
8 changes: 8 additions & 0 deletions .circleci/src/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ jobs:
service: mediorum
requires:
- push-mediorum
- push-arm-image:
name: push-uptime-arm
context: [Vercel, dockerhub]
service: uptime
requires:
- push-uptime




Expand Down Expand Up @@ -168,6 +175,7 @@ jobs:
- push-trpc
- push-healthz
- push-protocol-dashboard
- push-uptime
# uncomment these when arm builds are stable
# - push-identity-service-arm
# - push-mediorum-arm
Expand Down
6 changes: 3 additions & 3 deletions dev-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ If you still run into issues, you may execute a `docker system prune` to free ad

## Docker services

- Every Docker service is defined in one of the audius-protocol root-level .yml files (e.g., `docker-compose.discovery.yml` for services related to Discovery Node), and then it's imported into `docker-compose.yml` using [extends](https://docs.docker.com/compose/extends/#understand-the-extends-configuration) syntax
- Every Docker service is defined in one of the audius-protocol root-level .yml files (e.g., `docker-compose.discovery.prod.yml` for services related to Discovery Node), and then it's imported into `docker-compose.yml` using [extends](https://docs.docker.com/compose/extends/#understand-the-extends-configuration) syntax
- This pattern prevents the top-level `docker-compose.yml` file from growing too large and allows every service to have standardized logging, `extra_hosts` (allows the containers to talk to each other), and memory limits (makes `docker stats` more readable) by using the `<<: *common` property. This property is YAML's "merge key" syntax which essentially adds every field from the `common` variable defined at the top of the file
- `docker-compose.test.yml` also imports `docker-compose.yml` services for building images and testing in CI

Expand All @@ -122,8 +122,8 @@ If you still run into issues, you may execute a `docker system prune` to free ad

## Adding a service

1. Configure the service in its own .yml file, either using an existing one (e.g., use `docker-compose.discovery.yml` if it's a Discovery-related service) or by creating a new one
- The typical pattern here is to have a `Dockerfile` in the service's directory, and then when configuring the service (e.g., in top-level `docker-compose.discovery.yml`) use:
1. Configure the service in its own .yml file, either using an existing one (e.g., use `docker-compose.discovery.prod.yml` if it's a Discovery-related service) or by creating a new one
- The typical pattern here is to have a `Dockerfile` in the service's directory, and then when configuring the service (e.g., in top-level `docker-compose.discovery.prod.yml`) use:
```
service-name:
build:
Expand Down
Loading

0 comments on commit 7d92b1d

Please sign in to comment.