Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
85 changes: 80 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,25 @@ commands:
steps:
- run:
name: Run JS tests
when: always
command: |
if [ "$SETUP_OK" != "true" ]; then
echo "skipping"
exit 0
fi
sudo docker compose run --rm web bun test --reporter=junit --reporter-outfile=test-results/junit.xml
echo 'export COVERAGE_AVAILABLE=true' >> $BASH_ENV
lint-commands:
steps:
- run:
name: Run Ruby Linters
command: |
if [ "$SETUP_OK" != "true" ]; then
echo "skipping"
exit 0
fi
sudo docker compose run --rm web bun run ruby-check
when: always
- run:
name: Run JS Linters
command: |
Expand Down Expand Up @@ -178,6 +192,67 @@ commands:
fi
if [ "$CIRCLE_BRANCH" == "staging" ]; then echo; fi
when: always # change to `on_success` for a stricter comparison
- restore_cache:
keys:
- fe-coverage-staging-
- run:
name: Get current frontend coverage value
when: always
command: |
if [ -z "$COVERAGE_AVAILABLE" ]; then
echo "skipping"
exit 0
fi
eval "$(awk -F: '/^LH:/ { covered += $2 } /^LF:/ { total += $2 } END { printf "COVERED=%d\nTOTAL=%d\n", covered, total }' coverage_fe/lcov.info)"
FE_VALUE=$(awk "BEGIN { printf \"%.2f\", ($COVERED / $TOTAL) * 100 }")
echo "Covered lines: $COVERED, Total lines: $TOTAL, Coverage: $FE_VALUE%"
echo "export COVERED=$COVERED" >> "$BASH_ENV"
echo "export TOTAL=$TOTAL" >> "$BASH_ENV"
echo "export FE_VALUE=$FE_VALUE" >> "$BASH_ENV"
- run:
name: Load previous frontend coverage value
when: always
command: |
if [ -f fe_coverage.csv ]; then
PREV_FE=$(python -c 'import csv; f=open("fe_coverage.csv", newline=""); r=csv.reader(f); next(r, None); rows=[float(row[0]) for row in r if row and row[0]]; print(f"{rows[-1]:.2f}" if rows else "98.7")')
else
PREV_FE=98.7
fi
echo "Previous value: $PREV_FE%"
echo "export PREV_FE_VALUE=$PREV_FE" >> $BASH_ENV
- run:
name: Compare frontend coverage value
when: always
command: |
if [ -z "$COVERAGE_AVAILABLE" ]; then
echo "skipping"
exit 0
fi
percent_change=$(python -c 'import os; fe=float(os.environ.get("FE_VALUE","0") or 0); prev=float(os.environ.get("PREV_FE_VALUE","0") or 0); print("n/a" if prev==0 else f"{((fe-prev)/prev)*100:.2f}")')
echo "$FE_VALUE% ($percent_change% change)"
echo "export PERCENT_FE_CHANGE=$percent_change" >> "$BASH_ENV"
- run:
name: Save new frontend coverage value
when: always
command: |
if [ -z "$COVERAGE_AVAILABLE" ]; then
echo "skipping"
exit 0
fi
echo "$FE_VALUE"
if [ ! -f fe_coverage.csv ]; then
printf '%s\n' "percent,covered lines,total lines,percent change" > fe_coverage.csv
fi
printf '%s\n' "$FE_VALUE,$COVERED,$TOTAL,$PERCENT_FE_CHANGE" >> fe_coverage.csv
cat fe_coverage.csv
- save_cache:
key: fe-coverage-{{ .Branch }}-{{ epoch }}
paths:
- fe_coverage.csv
when: always
- store_artifacts:
path: fe_coverage.csv
destination: fe_coverage.csv
render-commands:
steps:
- run:
Expand Down Expand Up @@ -254,7 +329,7 @@ commands:
keys:
- fps_value-staging-
- run:
name: Load previous value
name: Load previous fps value
when: always
command: |
if [ -f fps_value.txt ]; then
Expand All @@ -265,14 +340,14 @@ commands:
echo "Previous value: $PREV fps"
echo "export PREV_VALUE=$PREV" >> $BASH_ENV
- run:
name: Compare value
name: Compare fps value
when: always
command: |
percent_change=$(python -c 'import os; fps=float(os.environ.get("FPS_VALUE","0") or 0); prev=float(os.environ.get("PREV_VALUE","0") or 0); print("n/a" if prev==0 else f"{((fps-prev)/prev)*100:.2f}")')
echo "$FPS_VALUE fps ($percent_change% change)"
echo "export PERCENT_CHANGE=$percent_change" >> "$BASH_ENV"
- run:
name: Save new value
name: Save new fps value
command: |
echo "$FPS_VALUE"
echo "$FPS_VALUE" > fps_value.txt
Expand Down Expand Up @@ -307,13 +382,13 @@ commands:
end-commands:
steps:
- run:
name: Fetch first artifact URL
name: Fetch image artifact URL
command: |
project_slug="gh/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
artifacts_json=$(curl -fsS \
-H "Accept: application/json" \
"https://circleci.com/api/v2/project/${project_slug}/${CIRCLE_BUILD_NUM}/artifacts")
artifact_url=$(printf "%s" "$artifacts_json" | python -c 'import json,sys; data=json.load(sys.stdin); items=data.get("items") or []; print(items[0].get("url","") if items else "")')
artifact_url=$(printf "%s" "$artifacts_json" | python -c 'import json,sys; data=json.load(sys.stdin); items=data.get("items") or []; print(next((item.get("url","") for item in items if item.get("url","").endswith(".png")), ""))')
echo "export ARTIFACT_URL=$artifact_url" >> "$BASH_ENV"
- send-notification:
message: "CI run succeeded"
Expand Down
255 changes: 255 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
plugins:
- rubocop-rails

AllCops:
Include:
- app/**/*.rb
# - config/**/*.rb
# - lib/**/*.rb
# - spec/**/*.rb
Exclude:
- docker_volumes/**/*
NewCops: enable

Style/StringLiterals:
Enabled: false

Style/MutableConstant:
Enabled: false

Style/TrailingCommaInHashLiteral:
Enabled: false

Style/TrailingCommaInArrayLiteral:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/PercentLiteralDelimiters:
Enabled: false

Style/SymbolArray:
Enabled: false

Style/Documentation:
Enabled: false

Metrics/MethodLength:
Enabled: false

Bundler/OrderedGems:
Enabled: false

Metrics/ClassLength:
Enabled: false

Rails/HttpStatus:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Rails/Output:
Enabled: false

Metrics/BlockLength:
Enabled: false

Naming/VariableNumber:
Enabled: false

Naming/VariableName:
Enabled: false

Style/ParenthesesAroundCondition:
Enabled: false

Style/RedundantSelf:
Enabled: false

Rails/TimeZone:
Enabled: false

Style/LineEndConcatenation:
Enabled: false

Style/FetchEnvVar:
Enabled: false

Rails/TopLevelHashWithIndifferentAccess:
Enabled: false

Rails/RedundantPresenceValidationOnBelongsTo:
Enabled: false

Rails/I18nLocaleTexts:
Enabled: false

Rails/FindByOrAssignmentMemoization:
Enabled: false

Rails/DeprecatedActiveModelErrorsMethods:
Enabled: false

Rails/ActionOrder:
Enabled: false

Naming/PredicateMethod:
Enabled: false

Lint/UselessConstantScoping:
Enabled: false

Layout/CommentIndentation:
Enabled: false

Layout/LineContinuationLeadingSpace:
Enabled: false

Layout/LineEndStringConcatenationIndentation:
Enabled: false

Lint/AmbiguousOperatorPrecedence:
Enabled: false

Lint/DuplicateBranch:
Enabled: false

Lint/EmptyClass:
Enabled: false

Lint/NoReturnInBeginEndBlocks:
Enabled: false

Layout/MultilineMethodCallBraceLayout:
Enabled: false

Layout/MultilineMethodCallIndentation:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Metrics/ModuleLength:
Enabled: false

Metrics/ParameterLists:
Enabled: false

Naming/AccessorMethodName:
Enabled: false

Naming/BinaryOperatorParameterName:
Enabled: false

Naming/HeredocDelimiterNaming:
Enabled: false

Naming/MemoizedInstanceVariableName:
Enabled: false

Naming/MethodName:
Enabled: false

Naming/MethodParameterName:
Enabled: false

Naming/PredicatePrefix:
Enabled: false

Naming/RescuedExceptionsVariableName:
Enabled: false

Rails/ApplicationRecord:
Enabled: false

Rails/BelongsTo:
Enabled: false

Rails/Delegate:
Enabled: false

Rails/HasManyOrHasOneDependent:
Enabled: false

Rails/InverseOf:
Enabled: false

Rails/SkipsModelValidations:
Enabled: false

Lint/MissingSuper:
Enabled: false

Style/TrailingCommaInArguments:
Enabled: false

Style/FormatStringToken:
Enabled: false

Style/GlobalVars:
Enabled: false

Style/NumericLiterals:
Enabled: false

Style/GuardClause: # 73
Enabled: false

Style/IfUnlessModifier: # 37
Enabled: false

Style/KeywordParametersOrder: # 3
Enabled: false

Style/Lambda: # 13
Enabled: false

Style/MultilineBlockChain: # 9
Enabled: false

Style/MultilineIfModifier: # 11
Enabled: false

Style/MultilineTernaryOperator: # 8
Enabled: false

Style/RedundantParentheses: # 35
Enabled: false

Style/RedundantRegexpEscape:
Enabled: true

Style/RedundantReturn: # 40
Enabled: false

Style/RescueStandardError: # 4
Enabled: false

Style/SafeNavigation: # 15
Enabled: false

Style/SingleArgumentDig: # 4
Enabled: false

Style/SingleLineMethods: # 3
Enabled: false

Style/SoleNestedConditional: # 3
Enabled: false

Style/StringConcatenation: # 20
Enabled: false

Style/StringLiteralsInInterpolation: # 13
Enabled: false

Style/TrivialAccessors: # 4
Enabled: false
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.1
4.0.2
Loading
Loading