Skip to content

Commit 97f0eaf

Browse files
authored
Merge branch 'arduino:master' into master
2 parents 65cfa21 + 408cee8 commit 97f0eaf

File tree

354 files changed

+45637
-85680
lines changed

Some content is hidden

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

354 files changed

+45637
-85680
lines changed

.dependabot/config.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.editorconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ indent_size = 4
1919
indent_style = space
2020
indent_size = 2
2121

22-
[*.sh]
23-
indent_style = tab
24-
indent_size = 4
22+
[*.{bash,sh}]
23+
indent_size = 2
24+
indent_style = space

.flake8

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
# TODO: move this to pyproject.toml when supported: https://gitlab.com/pycqa/flake8/merge_requests/245
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python/.flake8
2+
# See: https://flake8.pycqa.org/en/latest/user/configuration.html
3+
# The code style defined in this file is the official standardized style to be used in all Arduino tooling projects and
4+
# should not be modified.
25

36
[flake8]
4-
max-line-length = 120
7+
doctests = True
58
ignore =
69
E741,
7-
# W503 and W504 are mutually exclusive, so one or the other must be ignored.
8-
# PEP 8 recommends line break before, so we keep W504.
10+
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
911
W503
12+
max-complexity = 10
13+
max-line-length = 120
14+
select = E,W,F,C,N

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See: https://docs.github.com/en/code-security/supply-chain-security/configuration-options-for-dependency-updates#about-the-dependabotyml-file
2+
version: 2
3+
4+
updates:
5+
# Configure check for outdated GitHub Actions actions in workflows.
6+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md
7+
# See: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-actions-up-to-date-with-dependabot
8+
- package-ecosystem: github-actions
9+
directory: / # Check the repository's workflows under /.github/workflows/
10+
schedule:
11+
interval: daily
12+
labels:
13+
- "topic: dependencies"

.github/tools/fetch_athena_stats.sh

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
set -euo pipefail
1616

17-
! read -r -d '' query << EOM
17+
! read -r -d '' query <<EOM
1818
select
1919
replace(url_extract_path("d.url"), '/arduino-cli/arduino-cli_', '') as flavor,
2020
count("id") as gauge
@@ -27,40 +27,42 @@ group by 1
2727
EOM
2828

2929
queryExecutionId=$(
30-
aws athena start-query-execution \
31-
--query-string "${query}" \
32-
--query-execution-context "Database=demo_books" \
33-
--result-configuration "OutputLocation=${AWS_ATHENA_OUTPUT_LOCATION}" \
34-
--region us-east-1 | jq -r ".QueryExecutionId"
30+
aws athena start-query-execution \
31+
--query-string "${query}" \
32+
--query-execution-context "Database=demo_books" \
33+
--result-configuration "OutputLocation=${AWS_ATHENA_OUTPUT_LOCATION}" \
34+
--region us-east-1 | jq -r ".QueryExecutionId"
3535
)
3636

3737
echo "QueryExecutionId is ${queryExecutionId}"
3838
for i in $(seq 1 120); do
39-
queryState=$( aws athena get-query-execution \
40-
--query-execution-id "${queryExecutionId}" \
41-
--region us-east-1 | jq -r ".QueryExecution.Status.State"
42-
);
39+
queryState=$(
40+
aws athena get-query-execution \
41+
--query-execution-id "${queryExecutionId}" \
42+
--region us-east-1 | jq -r ".QueryExecution.Status.State"
43+
)
4344

4445
if [[ "${queryState}" == "SUCCEEDED" ]]; then
45-
break;
46-
fi;
46+
break
47+
fi
4748

4849
echo "QueryExecutionId ${queryExecutionId} - state is ${queryState}"
4950

5051
if [[ "${queryState}" == "FAILED" ]]; then
51-
exit 1;
52-
fi;
52+
exit 1
53+
fi
5354

5455
sleep 2
5556
done
5657

5758
echo "Query succeeded. Processing data"
58-
queryResult=$( aws athena get-query-results \
59-
--query-execution-id "${queryExecutionId}" \
60-
--region us-east-1 | jq --compact-output
61-
);
59+
queryResult=$(
60+
aws athena get-query-results \
61+
--query-execution-id "${queryExecutionId}" \
62+
--region us-east-1 | jq --compact-output
63+
)
6264

63-
! read -r -d '' jsonTemplate << EOM
65+
! read -r -d '' jsonTemplate <<EOM
6466
{
6567
"type": "gauge",
6668
"name": "arduino.downloads.total",
@@ -78,8 +80,8 @@ EOM
7880

7981
datapoints="["
8082
for row in $(echo "${queryResult}" | jq 'del(.ResultSet.Rows[0])' | jq -r '.ResultSet.Rows[] | .Data' --compact-output); do
81-
value=$(jq -r ".[1].VarCharValue" <<< "${row}")
82-
tag=$(jq -r ".[0].VarCharValue" <<< "${row}")
83+
value=$(jq -r ".[1].VarCharValue" <<<"${row}")
84+
tag=$(jq -r ".[0].VarCharValue" <<<"${row}")
8385
# Some splitting to obtain 0.6.0, Windows, 32bit elements from string 0.6.0_Windows_32bit.zip
8486
split=($(echo "$tag" | tr '_' '\n'))
8587
if [[ ${#split[@]} -ne 3 ]]; then
@@ -90,4 +92,4 @@ for row in $(echo "${queryResult}" | jq 'del(.ResultSet.Rows[0])' | jq -r '.Resu
9092
done
9193
datapoints="${datapoints::-1}]"
9294

93-
echo "::set-output name=result::$(jq --compact-output <<< "${datapoints}")"
95+
echo "::set-output name=result::$(jq --compact-output <<<"${datapoints}")"

.github/workflows/check-certificates.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,46 @@
1-
name: Check for issues with signing certificates
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-certificates.md
2+
name: Check Certificates
23

4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
35
on:
6+
push:
7+
paths:
8+
- ".github/workflows/check-certificates.ya?ml"
9+
pull_request:
10+
paths:
11+
- ".github/workflows/check-certificates.ya?ml"
412
schedule:
5-
# run every 10 hours
13+
# Run every 10 hours.
614
- cron: "0 */10 * * *"
7-
# workflow_dispatch event allows the workflow to be triggered manually.
8-
# This could be used to run an immediate check after updating certificate secrets.
9-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
1015
workflow_dispatch:
16+
repository_dispatch:
1117

1218
env:
13-
# Begin notifications when there are less than this many days remaining before expiration
19+
# Begin notifications when there are less than this many days remaining before expiration.
1420
EXPIRATION_WARNING_PERIOD: 30
1521

1622
jobs:
1723
check-certificates:
18-
# This workflow would fail in forks that don't have the certificate secrets defined
19-
if: github.repository == 'arduino/arduino-cli'
24+
name: ${{ matrix.certificate.identifier }}
25+
# Only run when the workflow will have access to the certificate secrets.
26+
if: >
27+
(github.event_name != 'pull_request' && github.repository == 'arduino/arduino-cli') ||
28+
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'arduino/arduino-cli')
2029
runs-on: ubuntu-latest
21-
2230
strategy:
2331
fail-fast: false
2432

2533
matrix:
2634
certificate:
27-
- identifier: macOS signing certificate # Text used to identify the certificate in notifications
28-
certificate-secret: INSTALLER_CERT_MAC_P12 # The name of the secret that contains the certificate
29-
password-secret: INSTALLER_CERT_MAC_PASSWORD # The name of the secret that contains the certificate password
35+
# Additional certificate definitions can be added to this list.
36+
- identifier: macOS signing certificate # Text used to identify certificate in notifications.
37+
certificate-secret: INSTALLER_CERT_MAC_P12 # Name of the secret that contains the certificate.
38+
password-secret: INSTALLER_CERT_MAC_PASSWORD # Name of the secret that contains the certificate password.
3039

3140
steps:
3241
- name: Set certificate path environment variable
3342
run: |
34-
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
43+
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
3544
echo "CERTIFICATE_PATH=${{ runner.temp }}/certificate.p12" >> "$GITHUB_ENV"
3645
3746
- name: Decode certificate
@@ -53,18 +62,17 @@ jobs:
5362
exit 1
5463
)
5564
56-
# See: https://github.com/rtCamp/action-slack-notify
5765
- name: Slack notification of certificate verification failure
5866
if: failure()
59-
uses: rtCamp/action-slack-notify@v2.1.0
6067
env:
61-
SLACK_WEBHOOK: ${{ secrets.TEAM_TOOLING_CHANNEL_SLACK_WEBHOOK }}
68+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
6269
SLACK_MESSAGE: |
6370
:warning::warning::warning::warning:
6471
WARNING: ${{ github.repository }} ${{ matrix.certificate.identifier }} verification failed!!!
6572
:warning::warning::warning::warning:
6673
SLACK_COLOR: danger
6774
MSG_MINIMAL: true
75+
uses: rtCamp/action-slack-notify@v2
6876

6977
- name: Get days remaining before certificate expiration date
7078
env:
@@ -93,7 +101,7 @@ jobs:
93101
94102
DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
95103
96-
# Display the expiration information in the log
104+
# Display the expiration information in the log.
97105
echo "Certificate expiration date: $EXPIRATION_DATE"
98106
echo "Days remaining before expiration: $DAYS_BEFORE_EXPIRATION"
99107
@@ -108,14 +116,14 @@ jobs:
108116
fi
109117
110118
- name: Slack notification of pending certificate expiration
111-
# Don't send spurious expiration notification if verification fails
119+
# Don't send spurious expiration notification if verification fails.
112120
if: failure() && steps.check-expiration.outcome == 'failure'
113-
uses: rtCamp/action-slack-notify@v2.1.0
114121
env:
115-
SLACK_WEBHOOK: ${{ secrets.TEAM_TOOLING_CHANNEL_SLACK_WEBHOOK }}
122+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
116123
SLACK_MESSAGE: |
117124
:warning::warning::warning::warning:
118125
WARNING: ${{ github.repository }} ${{ matrix.certificate.identifier }} will expire in ${{ steps.get-days-before-expiration.outputs.days }} days!!!
119126
:warning::warning::warning::warning:
120127
SLACK_COLOR: danger
121128
MSG_MINIMAL: true
129+
uses: rtCamp/action-slack-notify@v2

0 commit comments

Comments
 (0)