Skip to content

Commit

Permalink
Merge branch 'main' into fix/sia-validation-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ylfahfa authored Jan 22, 2025
2 parents 287d80b + 27c57ef commit 1b84302
Show file tree
Hide file tree
Showing 35 changed files with 804 additions and 775 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/dd-metrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
workflow_run:
workflows:
- '**'
types:
- completed
pull_request:
types:
- opened
- closed
- synchronize
- labeled
push:
branches:
- main

permissions:
actions: read
checks: read
contents: read
pull-requests: read

jobs:
send:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: int128/datadog-actions-metrics@v1
with:
collect-job-metrics: true
collect-step-metrics: true
datadog-api-key: ${{ secrets.DD_API_KEY }}
datadog-site: datadoghq.eu
send-pull-request-labels: true
24 changes: 19 additions & 5 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ env:
COMPOSE_HTTP_TIMEOUT: 180
SKIP_GENERATED_CACHE: ${{ contains(github.event.pull_request.labels.*.name, 'skip-generated-cache') }}
NX_AFFECTED_ALL: ${{ contains(github.event.pull_request.labels.*.name, 'nx-affected-all') }}
CHUNK_SIZE: ${{ vars.CHUNK_SIZE || 8 }}
DISABLE_CHUNKS: ${{ vars.DISABLE_CHUNKS || true }}
MAX_JOBS: ${{ vars.MAX_JOBS || 10 }}
NX_PARALLEL: ${{ vars.NX_PARALLEL || 15 }}
NX_MAX_PARALLEL: ${{ vars.NX_MAX_PARALLEL || 15 }}

jobs:
prepare:
Expand All @@ -27,7 +32,6 @@ jobs:

env:
AFFECTED_ALL: ${{ secrets.AFFECTED_ALL }}
CHUNK_SIZE: 7
SERVERSIDE_FEATURES_ON: ''
DOCKER_REGISTRY: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/
DOCKER_BASE_IMAGE_REGISTRY: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/ecr-public
Expand Down Expand Up @@ -68,11 +72,15 @@ jobs:
- name: Checking out relevant branches
run: |
set -euo pipefail
echo "CHUNK_SIZE: $CHUNK_SIZE"
echo "MAX_JOBS: $MAX_JOBS"
echo "NX_PARALLEL: $NX_PARALLEL"
set -x
git checkout -m "$GITHUB_HEAD_REF"
git checkout -m "$GITHUB_BASE_REF"
git checkout -m "$GITHUB_SHA"
git config --global user.email "[email protected]"
git config --global user.name "CI Bot"
Expand Down Expand Up @@ -141,15 +149,23 @@ jobs:
- name: Prepare lint targets
id: lint_projects
env:
DISABLE_CHUNKS: 'true'
DISABLE_PROBLEMATIC: 'true'
DISABLE_GROUPING: 'true'
run: |
set -euo pipefail
echo "DISABLE_CHUNKS: $DISABLE_CHUNKS"
CHUNKS="$(./scripts/ci/generate-chunks.sh lint)"
if [[ "$CHUNKS" != "[]" ]]; then
echo "CHUNKS={\"projects\":$CHUNKS}" >> "$GITHUB_OUTPUT"
fi
- name: Prepare test targets
id: test_projects
env:
DISABLE_CHUNKS: 'true'
DISABLE_GROUPING: 'true'
run: |
set -euo pipefail
CHUNKS="$(./scripts/ci/generate-chunks.sh test)"
Expand All @@ -172,7 +188,8 @@ jobs:
- name: Prepare build targets
id: build_projects
env:
CHUNK_SIZE: 4
DISABLE_CHUNKS: 'true'
DISABLE_GROUPING: 'true'
run: |
set -euo pipefail
CHUNKS="$(./scripts/ci/generate-chunks.sh build)"
Expand All @@ -197,7 +214,6 @@ jobs:
timeout-minutes: 45
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
MAX_JOBS: 1
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.TEST_CHUNKS) }}
Expand Down Expand Up @@ -361,7 +377,6 @@ jobs:
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
NODE_OPTIONS: --max-old-space-size=4096
MAX_JOBS: 3
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.LINT_CHUNKS) }}
Expand Down Expand Up @@ -391,7 +406,6 @@ jobs:
timeout-minutes: 35
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
MAX_JOBS: 2
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.BUILD_CHUNKS) }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ env:
NX_AFFECTED_ALL: ${{ contains(github.event.pull_request.labels.*.name, 'nx-affected-all') }}
CONFIGCAT_MAIN_CONFIG_ID: 08d8c761-021c-46f0-8671-6244663a372f
CONFIGCAT_MOBILE_APP_CONFIG_ID: 08daf234-7573-4b3b-85f6-189fc7502542
CHUNK_SIZE: ${{ vars.CHUNK_SIZE || 8 }}
DISABLE_CHUNKS: ${{ vars.DISABLE_CHUNKS || true }}
MAX_JOBS: ${{ vars.MAX_JOBS || 10 }}
NX_PARALLEL: ${{ vars.NX_PARALLEL || 10 }}
NX_MAX_PARALLEL: ${{ vars.NX_MAX_PARALLEL || 10 }}

jobs:
pre-checks:
Expand Down Expand Up @@ -448,7 +453,6 @@ jobs:
timeout-minutes: 35
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
MAX_JOBS: 1
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.TEST_CHUNKS) }}
Expand Down
7 changes: 7 additions & 0 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ definitions:
# - pattern: "main"
# include: true
# source: true
environment: &environment
node: 20.15.0
shared_envs: &shared_envs
XCODE_WORKSPACE: 'IslandApp.xcworkspace'
CM_CLONE_DEPTH: 200
Expand Down Expand Up @@ -95,6 +97,7 @@ definitions:
google_play:
credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
track: internal
changes_not_sent_for_review: true
slack_errors: &slack_errors
slack:
channel: '#team-app-builds'
Expand All @@ -116,6 +119,7 @@ workflows:
integrations:
app_store_connect: 'Island.is API Key'
environment:
<<: *environment
ios_signing:
distribution_type: app_store
bundle_identifier: is.island.app
Expand Down Expand Up @@ -149,6 +153,7 @@ workflows:
integrations:
app_store_connect: 'Island.is API Key'
environment:
<<: *environment
ios_signing:
distribution_type: app_store
bundle_identifier: is.island.app.dev
Expand Down Expand Up @@ -186,6 +191,7 @@ workflows:
- $CM_BUILD_DIR/.yarn/cache
- $CM_BUILD_DIR/.cache/nx
environment:
<<: *environment
android_signing:
- island-upload-keystore
groups:
Expand Down Expand Up @@ -215,6 +221,7 @@ workflows:
# instance_type: linux_x2
cache: *android_cache
environment:
<<: *environment
android_signing:
- island-upload-keystore
groups:
Expand Down
21 changes: 17 additions & 4 deletions infra/src/cli/generate-chart-values.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { renderEnv } from './render-env'
import { ChartName, Deployments, Charts } from '../uber-charts/all-charts'
import { writeFileSync, mkdirSync } from 'fs'
import { writeFileSync, mkdirSync, rmSync } from 'fs'
import { Envs } from '../environments'
import { OpsEnv } from '../dsl/types/input-types'
import path from 'path'
Expand All @@ -21,6 +21,18 @@ const headerComment = `#########################################################
`

const relativeChartDir = '../../../charts'
const cleanOrphanDirs = (filePath: string): void => {
try {
rmSync(filePath, { recursive: true })
} catch (error) {
if (error instanceof Error) {
console.error(
`Failed to clean orphan directories at ${filePath}: ${error.message}`,
)
}
}
}
const writeYamlFile = (filePath: string, content: unknown) => {
const doc = new yaml.Document()
doc.contents = doc.createNode(content)
Expand All @@ -31,8 +43,9 @@ const writeYamlFile = (filePath: string, content: unknown) => {
}

const generateChartValues = async () => {
console.log('Cleaning orphan charts')
cleanOrphanDirs(path.join(__dirname, relativeChartDir))
console.log('Gathering charts')

for (const [name, envs] of Object.entries(Deployments)) {
for (const [envType, envName] of Object.entries(envs)) {
console.log(`Processing ${name} ${envName} ${envType}`)
Expand All @@ -45,7 +58,7 @@ const generateChartValues = async () => {
writeYamlFile(
path.join(
__dirname,
'/../../../charts',
relativeChartDir,
name,
`values.${Envs[envName].type}.yaml`,
),
Expand All @@ -67,7 +80,7 @@ const generateChartValues = async () => {
writeYamlFile(
path.join(
__dirname,
`/../../../charts/${name}-services`,
`${relativeChartDir}/${name}-services`,
serviceName,
`values.${Envs[envName].type}.yaml`,
),
Expand Down
14 changes: 7 additions & 7 deletions infra/src/cli/render-local-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ export async function runLocalServices(
}
if (renderedLocalServices.mocks) {
logger.warn('Starting mocks in the background')
processes.push(
runCommand({
command: renderedLocalServices.mocks,
project: 'mocks',
dryRun,
}),
)
const options = {
command: renderedLocalServices.mocks,
project: 'mocks',
dryRun,
}
logger.debug('Mocks command options', { options })
processes.push(runCommand(options))
}

for (const [name, service] of Object.entries(
Expand Down
9 changes: 4 additions & 5 deletions infra/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ export async function runCommand({
shell: true,
stdio: 'pipe',
})
proc.stdout?.on('data', (data) => {
logger.debug('Process started', { proc, cwd, command })
proc.stdout?.on('data', (data: Buffer | string) => {
data
.toString()
.split('\n')
.split(/\r?\n|\r|\n/g)
.forEach((line: string) => {
if (line.trim().length > 0) {
logger.info(logMessage(line))
}
logger.info(logMessage(line.trim()))
})
})
proc.stderr?.on('data', (data) => {
Expand Down

This file was deleted.

Loading

0 comments on commit 1b84302

Please sign in to comment.