Skip to content

Commit 289102d

Browse files
Merge pull request #2511 from FarmBot/staging
v15.23.0
2 parents 1db8e13 + f2c905a commit 289102d

520 files changed

Lines changed: 6946 additions & 3059 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,25 @@ commands:
114114
steps:
115115
- run:
116116
name: Run JS tests
117+
when: always
117118
command: |
119+
if [ "$SETUP_OK" != "true" ]; then
120+
echo "skipping"
121+
exit 0
122+
fi
118123
sudo docker compose run --rm web bun test --reporter=junit --reporter-outfile=test-results/junit.xml
119124
echo 'export COVERAGE_AVAILABLE=true' >> $BASH_ENV
120125
lint-commands:
121126
steps:
127+
- run:
128+
name: Run Ruby Linters
129+
command: |
130+
if [ "$SETUP_OK" != "true" ]; then
131+
echo "skipping"
132+
exit 0
133+
fi
134+
sudo docker compose run --rm web bun run ruby-check
135+
when: always
122136
- run:
123137
name: Run JS Linters
124138
command: |
@@ -178,6 +192,67 @@ commands:
178192
fi
179193
if [ "$CIRCLE_BRANCH" == "staging" ]; then echo; fi
180194
when: always # change to `on_success` for a stricter comparison
195+
- restore_cache:
196+
keys:
197+
- fe-coverage-staging-
198+
- run:
199+
name: Get current frontend coverage value
200+
when: always
201+
command: |
202+
if [ -z "$COVERAGE_AVAILABLE" ]; then
203+
echo "skipping"
204+
exit 0
205+
fi
206+
eval "$(awk -F: '/^LH:/ { covered += $2 } /^LF:/ { total += $2 } END { printf "COVERED=%d\nTOTAL=%d\n", covered, total }' coverage_fe/lcov.info)"
207+
FE_VALUE=$(awk "BEGIN { printf \"%.2f\", ($COVERED / $TOTAL) * 100 }")
208+
echo "Covered lines: $COVERED, Total lines: $TOTAL, Coverage: $FE_VALUE%"
209+
echo "export COVERED=$COVERED" >> "$BASH_ENV"
210+
echo "export TOTAL=$TOTAL" >> "$BASH_ENV"
211+
echo "export FE_VALUE=$FE_VALUE" >> "$BASH_ENV"
212+
- run:
213+
name: Load previous frontend coverage value
214+
when: always
215+
command: |
216+
if [ -f fe_coverage.csv ]; then
217+
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")')
218+
else
219+
PREV_FE=98.7
220+
fi
221+
echo "Previous value: $PREV_FE%"
222+
echo "export PREV_FE_VALUE=$PREV_FE" >> $BASH_ENV
223+
- run:
224+
name: Compare frontend coverage value
225+
when: always
226+
command: |
227+
if [ -z "$COVERAGE_AVAILABLE" ]; then
228+
echo "skipping"
229+
exit 0
230+
fi
231+
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}")')
232+
echo "$FE_VALUE% ($percent_change% change)"
233+
echo "export PERCENT_FE_CHANGE=$percent_change" >> "$BASH_ENV"
234+
- run:
235+
name: Save new frontend coverage value
236+
when: always
237+
command: |
238+
if [ -z "$COVERAGE_AVAILABLE" ]; then
239+
echo "skipping"
240+
exit 0
241+
fi
242+
echo "$FE_VALUE"
243+
if [ ! -f fe_coverage.csv ]; then
244+
printf '%s\n' "percent,covered lines,total lines,percent change" > fe_coverage.csv
245+
fi
246+
printf '%s\n' "$FE_VALUE,$COVERED,$TOTAL,$PERCENT_FE_CHANGE" >> fe_coverage.csv
247+
cat fe_coverage.csv
248+
- save_cache:
249+
key: fe-coverage-{{ .Branch }}-{{ epoch }}
250+
paths:
251+
- fe_coverage.csv
252+
when: always
253+
- store_artifacts:
254+
path: fe_coverage.csv
255+
destination: fe_coverage.csv
181256
render-commands:
182257
steps:
183258
- run:
@@ -254,7 +329,7 @@ commands:
254329
keys:
255330
- fps_value-staging-
256331
- run:
257-
name: Load previous value
332+
name: Load previous fps value
258333
when: always
259334
command: |
260335
if [ -f fps_value.txt ]; then
@@ -265,14 +340,14 @@ commands:
265340
echo "Previous value: $PREV fps"
266341
echo "export PREV_VALUE=$PREV" >> $BASH_ENV
267342
- run:
268-
name: Compare value
343+
name: Compare fps value
269344
when: always
270345
command: |
271346
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}")')
272347
echo "$FPS_VALUE fps ($percent_change% change)"
273348
echo "export PERCENT_CHANGE=$percent_change" >> "$BASH_ENV"
274349
- run:
275-
name: Save new value
350+
name: Save new fps value
276351
command: |
277352
echo "$FPS_VALUE"
278353
echo "$FPS_VALUE" > fps_value.txt
@@ -307,13 +382,13 @@ commands:
307382
end-commands:
308383
steps:
309384
- run:
310-
name: Fetch first artifact URL
385+
name: Fetch image artifact URL
311386
command: |
312387
project_slug="gh/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
313388
artifacts_json=$(curl -fsS \
314389
-H "Accept: application/json" \
315390
"https://circleci.com/api/v2/project/${project_slug}/${CIRCLE_BUILD_NUM}/artifacts")
316-
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 "")')
391+
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")), ""))')
317392
echo "export ARTIFACT_URL=$artifact_url" >> "$BASH_ENV"
318393
- send-notification:
319394
message: "CI run succeeded"

.rubocop.yml

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
plugins:
2+
- rubocop-rails
3+
4+
AllCops:
5+
Include:
6+
- app/**/*.rb
7+
# - config/**/*.rb
8+
# - lib/**/*.rb
9+
# - spec/**/*.rb
10+
Exclude:
11+
- docker_volumes/**/*
12+
NewCops: enable
13+
14+
Style/StringLiterals:
15+
Enabled: false
16+
17+
Style/MutableConstant:
18+
Enabled: false
19+
20+
Style/TrailingCommaInHashLiteral:
21+
Enabled: false
22+
23+
Style/TrailingCommaInArrayLiteral:
24+
Enabled: false
25+
26+
Style/FrozenStringLiteralComment:
27+
Enabled: false
28+
29+
Style/PercentLiteralDelimiters:
30+
Enabled: false
31+
32+
Style/SymbolArray:
33+
Enabled: false
34+
35+
Style/Documentation:
36+
Enabled: false
37+
38+
Metrics/MethodLength:
39+
Enabled: false
40+
41+
Bundler/OrderedGems:
42+
Enabled: false
43+
44+
Metrics/ClassLength:
45+
Enabled: false
46+
47+
Rails/HttpStatus:
48+
Enabled: false
49+
50+
Metrics/AbcSize:
51+
Enabled: false
52+
53+
Metrics/CyclomaticComplexity:
54+
Enabled: false
55+
56+
Metrics/PerceivedComplexity:
57+
Enabled: false
58+
59+
Rails/Output:
60+
Enabled: false
61+
62+
Metrics/BlockLength:
63+
Enabled: false
64+
65+
Naming/VariableNumber:
66+
Enabled: false
67+
68+
Naming/VariableName:
69+
Enabled: false
70+
71+
Style/ParenthesesAroundCondition:
72+
Enabled: false
73+
74+
Style/RedundantSelf:
75+
Enabled: false
76+
77+
Rails/TimeZone:
78+
Enabled: false
79+
80+
Style/LineEndConcatenation:
81+
Enabled: false
82+
83+
Style/FetchEnvVar:
84+
Enabled: false
85+
86+
Rails/TopLevelHashWithIndifferentAccess:
87+
Enabled: false
88+
89+
Rails/RedundantPresenceValidationOnBelongsTo:
90+
Enabled: false
91+
92+
Rails/I18nLocaleTexts:
93+
Enabled: false
94+
95+
Rails/FindByOrAssignmentMemoization:
96+
Enabled: false
97+
98+
Rails/DeprecatedActiveModelErrorsMethods:
99+
Enabled: false
100+
101+
Rails/ActionOrder:
102+
Enabled: false
103+
104+
Naming/PredicateMethod:
105+
Enabled: false
106+
107+
Lint/UselessConstantScoping:
108+
Enabled: false
109+
110+
Layout/CommentIndentation:
111+
Enabled: false
112+
113+
Layout/LineContinuationLeadingSpace:
114+
Enabled: false
115+
116+
Layout/LineEndStringConcatenationIndentation:
117+
Enabled: false
118+
119+
Lint/AmbiguousOperatorPrecedence:
120+
Enabled: false
121+
122+
Lint/DuplicateBranch:
123+
Enabled: false
124+
125+
Lint/EmptyClass:
126+
Enabled: false
127+
128+
Lint/NoReturnInBeginEndBlocks:
129+
Enabled: false
130+
131+
Layout/MultilineMethodCallBraceLayout:
132+
Enabled: false
133+
134+
Layout/MultilineMethodCallIndentation:
135+
Enabled: false
136+
137+
Metrics/BlockNesting:
138+
Enabled: false
139+
140+
Metrics/ModuleLength:
141+
Enabled: false
142+
143+
Metrics/ParameterLists:
144+
Enabled: false
145+
146+
Naming/AccessorMethodName:
147+
Enabled: false
148+
149+
Naming/BinaryOperatorParameterName:
150+
Enabled: false
151+
152+
Naming/HeredocDelimiterNaming:
153+
Enabled: false
154+
155+
Naming/MemoizedInstanceVariableName:
156+
Enabled: false
157+
158+
Naming/MethodName:
159+
Enabled: false
160+
161+
Naming/MethodParameterName:
162+
Enabled: false
163+
164+
Naming/PredicatePrefix:
165+
Enabled: false
166+
167+
Naming/RescuedExceptionsVariableName:
168+
Enabled: false
169+
170+
Rails/ApplicationRecord:
171+
Enabled: false
172+
173+
Rails/BelongsTo:
174+
Enabled: false
175+
176+
Rails/Delegate:
177+
Enabled: false
178+
179+
Rails/HasManyOrHasOneDependent:
180+
Enabled: false
181+
182+
Rails/InverseOf:
183+
Enabled: false
184+
185+
Rails/SkipsModelValidations:
186+
Enabled: false
187+
188+
Lint/MissingSuper:
189+
Enabled: false
190+
191+
Style/TrailingCommaInArguments:
192+
Enabled: false
193+
194+
Style/FormatStringToken:
195+
Enabled: false
196+
197+
Style/GlobalVars:
198+
Enabled: false
199+
200+
Style/NumericLiterals:
201+
Enabled: false
202+
203+
Style/GuardClause: # 73
204+
Enabled: false
205+
206+
Style/IfUnlessModifier: # 37
207+
Enabled: false
208+
209+
Style/KeywordParametersOrder: # 3
210+
Enabled: false
211+
212+
Style/Lambda: # 13
213+
Enabled: false
214+
215+
Style/MultilineBlockChain: # 9
216+
Enabled: false
217+
218+
Style/MultilineIfModifier: # 11
219+
Enabled: false
220+
221+
Style/MultilineTernaryOperator: # 8
222+
Enabled: false
223+
224+
Style/RedundantParentheses: # 35
225+
Enabled: false
226+
227+
Style/RedundantRegexpEscape:
228+
Enabled: true
229+
230+
Style/RedundantReturn: # 40
231+
Enabled: false
232+
233+
Style/RescueStandardError: # 4
234+
Enabled: false
235+
236+
Style/SafeNavigation: # 15
237+
Enabled: false
238+
239+
Style/SingleArgumentDig: # 4
240+
Enabled: false
241+
242+
Style/SingleLineMethods: # 3
243+
Enabled: false
244+
245+
Style/SoleNestedConditional: # 3
246+
Enabled: false
247+
248+
Style/StringConcatenation: # 20
249+
Enabled: false
250+
251+
Style/StringLiteralsInInterpolation: # 13
252+
Enabled: false
253+
254+
Style/TrivialAccessors: # 4
255+
Enabled: false

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.1
1+
4.0.2

0 commit comments

Comments
 (0)