Skip to content

Commit ee17a87

Browse files
authored
Merge branch 'arduino:main' into main
2 parents 6064dc3 + 1724e56 commit ee17a87

File tree

5 files changed

+117
-73
lines changed

5 files changed

+117
-73
lines changed

.github/workflows/build.yml

+35-17
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ on:
1111
branches:
1212
- main
1313

14+
env:
15+
# As defined by the Taskfile's PROJECT_NAME variable
16+
PROJECT_NAME: arduino-language-server
17+
ARTIFACT_PREFIX: dist-
18+
AWS_REGION: "us-east-1"
19+
# The project's folder on Arduino's download server for uploading builds
20+
AWS_PLUGIN_TARGET: /arduino-language-server/nightly/
21+
# As defined by the Taskfile's DIST_DIR variable
22+
DIST_DIR: dist
23+
1424
jobs:
1525

1626
build:
@@ -20,13 +30,16 @@ jobs:
2030
strategy:
2131
matrix:
2232
config:
23-
- os: ubuntu-latest
33+
- artifact-suffix: Linux_64bit
34+
os: ubuntu-latest
2435
ExecutableSuffix: ''
2536
Exports: ''
26-
- os: macos-latest
37+
- artifact-suffix: macOS_ARM64
38+
os: macos-latest
2739
ExecutableSuffix: ''
2840
Exports: 'CGO_ENABLED=1 MACOSX_DEPLOYMENT_TARGET=10.14 '
29-
- os: windows-2019
41+
- artifact-suffix: Windows_64bit
42+
os: windows-2019
3043
ExecutableSuffix: '.exe'
3144
Exports: ''
3245
runs-on: ${{ matrix.config.os }}
@@ -48,9 +61,9 @@ jobs:
4861
run: 7z a "${{ github.workspace }}/${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip" "${{ github.workspace }}/${{ env.BUILD_OUTPUT_DIRECTORY }}/${{ runner.OS }}_amd64/*"
4962

5063
- name: Upload Workflow Artifact [GitHub Actions]
51-
uses: actions/upload-artifact@v3
64+
uses: actions/upload-artifact@v4
5265
with:
53-
name: build-artifacts
66+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.config.artifact-suffix }}
5467
# this makes the artifact a .zip of the .zip archive, which is currently necessary to preserve the executable file permissions
5568
# see: https://github.com/actions/upload-artifact/issues/38
5669
path: ${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip
@@ -59,19 +72,24 @@ jobs:
5972
needs: build
6073
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
6174
runs-on: ubuntu-latest
75+
environment: production
76+
permissions:
77+
contents: write
78+
id-token: write # This is required for requesting the JWT
6279
steps:
6380
- name: Download Workflow Artifact [GitHub Actions]
64-
uses: actions/download-artifact@v3
81+
uses: actions/download-artifact@v4
82+
with:
83+
pattern: ${{ env.ARTIFACT_PREFIX }}*
84+
merge-multiple: true
85+
path: ${{ env.DIST_DIR }}
86+
87+
- name: configure aws credentials
88+
uses: aws-actions/configure-aws-credentials@v4
6589
with:
66-
name: build-artifacts
67-
path: build-artifacts
90+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
91+
role-session-name: "github_${{ env.PROJECT_NAME }}"
92+
aws-region: ${{ env.AWS_REGION }}
6893

69-
- name: Publish Nightly [S3]
70-
uses: docker://plugins/s3
71-
env:
72-
PLUGIN_SOURCE: "build-artifacts/*"
73-
PLUGIN_TARGET: "/arduino-language-server/nightly"
74-
PLUGIN_STRIP_PREFIX: "build-artifacts/"
75-
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
76-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
77-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
94+
- name: Upload release files on Arduino downloads servers
95+
run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}

.github/workflows/check-go-dependencies-task.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
# Some might find it convenient to have CI generate the cache rather than setting up for it locally
109109
- name: Upload cache to workflow artifact
110110
if: failure() && steps.diff.outcome == 'failure'
111-
uses: actions/upload-artifact@v3
111+
uses: actions/upload-artifact@v4
112112
with:
113113
if-no-files-found: error
114114
include-hidden-files: true

.github/workflows/release-go-task.yml

+64-42
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ env:
88
DIST_DIR: dist
99
# The project's folder on Arduino's download server for uploading builds
1010
AWS_PLUGIN_TARGET: /arduino-language-server/
11-
ARTIFACT_NAME: dist
11+
AWS_REGION: "us-east-1"
12+
ARTIFACT_PREFIX: dist-
1213

1314
on:
1415
push:
@@ -22,15 +23,24 @@ jobs:
2223
strategy:
2324
matrix:
2425
os:
25-
- Windows_32bit
26-
- Windows_64bit
27-
- Linux_32bit
28-
- Linux_64bit
29-
- Linux_ARMv6
30-
- Linux_ARMv7
31-
- Linux_ARM64
32-
- macOS_64bit
33-
- macOS_ARM64
26+
- task: Windows_32bit
27+
artifact-suffix: Windows_32bit
28+
- task: Windows_64bit
29+
artifact-suffix: Windows_64bit
30+
- task: Linux_32bit
31+
artifact-suffix: Linux_32bit
32+
- task: Linux_64bit
33+
artifact-suffix: Linux_64bit
34+
- task: Linux_ARMv6
35+
artifact-suffix: Linux_ARMv6
36+
- task: Linux_ARMv7
37+
artifact-suffix: Linux_ARMv7
38+
- task: Linux_ARM64
39+
artifact-suffix: Linux_ARM64
40+
- task: macOS_64bit
41+
artifact-suffix: macOS_64bit
42+
- task: macOS_ARM64
43+
artifact-suffix: macOS_ARM64
3444

3545
steps:
3646
- name: Checkout repository
@@ -40,7 +50,7 @@ jobs:
4050

4151
- name: Create changelog
4252
# Avoid creating the same changelog for each os
43-
if: matrix.os == 'Windows_32bit'
53+
if: matrix.os.task == 'Windows_32bit'
4454
uses: arduino/create-changelog@v1
4555
with:
4656
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -55,17 +65,17 @@ jobs:
5565
version: 3.x
5666

5767
- name: Build
58-
run: task dist:${{ matrix.os }}
68+
run: task dist:${{ matrix.os.task }}
5969

6070
- name: Upload artifacts
61-
uses: actions/upload-artifact@v3
71+
uses: actions/upload-artifact@v4
6272
with:
6373
if-no-files-found: error
64-
name: ${{ env.ARTIFACT_NAME }}
74+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.os.artifact-suffix }}
6575
path: ${{ env.DIST_DIR }}
6676

6777
notarize-macos:
68-
name: Notarize ${{ matrix.artifact.name }}
78+
name: Notarize ${{ matrix.build.folder-suffix }}
6979
runs-on: macos-latest
7080
needs: create-release-artifacts
7181
outputs:
@@ -77,20 +87,29 @@ jobs:
7787

7888
strategy:
7989
matrix:
80-
artifact:
81-
- name: darwin_amd64
82-
path: "macOS_64bit.tar.gz"
83-
- name: darwin_arm64
84-
path: "macOS_ARM64.tar.gz"
90+
build:
91+
- artifact-suffix: macOS_64bit
92+
folder-suffix: darwin_amd64
93+
package-suffix: "macOS_64bit.tar.gz"
94+
- artifact-suffix: macOS_ARM64
95+
folder-suffix: darwin_arm64
96+
package-suffix: "macOS_ARM64.tar.gz"
8597

8698
steps:
99+
- name: Set environment variables
100+
run: |
101+
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
102+
echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV"
103+
TAG="${GITHUB_REF/refs\/tags\//}"
104+
echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV
105+
87106
- name: Checkout repository
88107
uses: actions/checkout@v4
89108

90109
- name: Download artifacts
91-
uses: actions/download-artifact@v3
110+
uses: actions/download-artifact@v4
92111
with:
93-
name: ${{ env.ARTIFACT_NAME }}
112+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
94113
path: ${{ env.DIST_DIR }}
95114

96115
- name: Import Code-Signing Certificates
@@ -127,7 +146,7 @@ jobs:
127146
run: |
128147
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
129148
# See: https://github.com/Bearer/gon#configuration-file
130-
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
149+
source = ["${{ env.DIST_DIR }}/${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"]
131150
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
132151
133152
sign {
@@ -156,30 +175,33 @@ jobs:
156175
run: |
157176
# GitHub's upload/download-artifact actions don't preserve file permissions,
158177
# so we need to add execution permission back until the action is made to do this.
159-
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
160-
TAG="${GITHUB_REF/refs\/tags\//}"
161-
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
162-
tar -czvf "$PACKAGE_FILENAME" \
163-
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
178+
chmod +x "${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"
179+
tar -czvf "${{ env.PACKAGE_FILENAME }}" \
180+
-C "${{ env.BUILD_FOLDER }}/" "${{ env.PROJECT_NAME }}" \
164181
-C ../../ LICENSE.txt
165-
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
166182
167-
- name: Upload artifact
168-
uses: actions/upload-artifact@v3
183+
- name: Replace artifact with notarized build
184+
uses: actions/upload-artifact@v4
169185
with:
170186
if-no-files-found: error
171-
name: ${{ env.ARTIFACT_NAME }}
187+
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
188+
overwrite: true
172189
path: ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}
173190

174191
create-release:
175192
runs-on: ubuntu-latest
193+
environment: production
176194
needs: notarize-macos
195+
permissions:
196+
contents: write
197+
id-token: write # This is required for requesting the JWT
177198

178199
steps:
179200
- name: Download artifact
180-
uses: actions/download-artifact@v3
201+
uses: actions/download-artifact@v4
181202
with:
182-
name: ${{ env.ARTIFACT_NAME }}
203+
pattern: ${{ env.ARTIFACT_PREFIX }}*
204+
merge-multiple: true
183205
path: ${{ env.DIST_DIR }}
184206

185207
- name: Create checksum file
@@ -216,12 +238,12 @@ jobs:
216238
# (all the files we need are in the DIST_DIR root)
217239
artifacts: ${{ env.DIST_DIR }}/*
218240

241+
- name: configure aws credentials
242+
uses: aws-actions/configure-aws-credentials@v4
243+
with:
244+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
245+
role-session-name: "github_${{ env.PROJECT_NAME }}"
246+
aws-region: ${{ env.AWS_REGION }}
247+
219248
- name: Upload release files on Arduino downloads servers
220-
uses: docker://plugins/s3
221-
env:
222-
PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*"
223-
PLUGIN_TARGET: ${{ env.AWS_PLUGIN_TARGET }}
224-
PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/"
225-
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
226-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
227-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
249+
run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}

.github/workflows/sync-labels.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919

2020
env:
2121
CONFIGURATIONS_FOLDER: .github/label-configuration-files
22-
CONFIGURATIONS_ARTIFACT: label-configuration-files
22+
CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file-
2323

2424
jobs:
2525
check:
@@ -71,13 +71,13 @@ jobs:
7171
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}
7272

7373
- name: Pass configuration files to next job via workflow artifact
74-
uses: actions/upload-artifact@v3
74+
uses: actions/upload-artifact@v4
7575
with:
7676
path: |
7777
*.yaml
7878
*.yml
7979
if-no-files-found: error
80-
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
80+
name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}${{ matrix.filename }}
8181

8282
sync:
8383
needs: download
@@ -108,16 +108,17 @@ jobs:
108108
- name: Checkout repository
109109
uses: actions/checkout@v4
110110

111-
- name: Download configuration files artifact
112-
uses: actions/download-artifact@v3
111+
- name: Download configuration file artifacts
112+
uses: actions/download-artifact@v4
113113
with:
114-
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
114+
merge-multiple: true
115+
pattern: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}*
115116
path: ${{ env.CONFIGURATIONS_FOLDER }}
116117

117-
- name: Remove unneeded artifact
118-
uses: geekyeggo/delete-artifact@v2
118+
- name: Remove unneeded artifacts
119+
uses: geekyeggo/delete-artifact@v5
119120
with:
120-
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
121+
name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}*
121122

122123
- name: Merge label configuration files
123124
run: |

DistTasks.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ tasks:
131131
desc: Builds Linux ARMv6 binaries
132132
dir: "{{.DIST_DIR}}"
133133
cmds:
134+
# "git config safe.directory" is required until this is fixed https://github.com/elastic/golang-crossbuild/issues/232
134135
- |
135136
docker run -v `pwd`/..:/home/build -w /home/build \
136137
-e CGO_ENABLED=1 \
137138
{{.CONTAINER}}:{{.CONTAINER_TAG}} \
138-
--build-cmd "{{.BUILD_COMMAND}}" \
139+
--build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \
139140
-p "{{.BUILD_PLATFORM}}"
140141
141142
tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}}
@@ -172,7 +173,7 @@ tasks:
172173
#
173174
# Until there is a fix released we must use a recent gcc for Linux_ARMv6 build, so for this
174175
# build we select the debian10 based container.
175-
CONTAINER_TAG: "{{.GO_VERSION}}-armel-debian10"
176+
CONTAINER_TAG: "{{.GO_VERSION}}-armel-debian11"
176177
PACKAGE_PLATFORM: "Linux_ARMv6"
177178
PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz"
178179

@@ -201,11 +202,12 @@ tasks:
201202
desc: Builds Mac OS X 64 bit binaries
202203
dir: "{{.DIST_DIR}}"
203204
cmds:
205+
# "git config safe.directory" is required until this is fixed https://github.com/elastic/golang-crossbuild/issues/232
204206
- |
205207
docker run -v `pwd`/..:/home/build -w /home/build \
206208
-e CGO_ENABLED=1 \
207209
{{.CONTAINER}}:{{.CONTAINER_TAG}} \
208-
--build-cmd "{{.BUILD_COMMAND}}" \
210+
--build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \
209211
-p "{{.BUILD_PLATFORM}}"
210212
211213
tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}}
@@ -235,11 +237,12 @@ tasks:
235237
desc: Builds Mac OS X ARM64 binaries
236238
dir: "{{.DIST_DIR}}"
237239
cmds:
240+
# "git config safe.directory" is required until this is fixed https://github.com/elastic/golang-crossbuild/issues/232
238241
- |
239242
docker run -v `pwd`/..:/home/build -w /home/build \
240243
-e CGO_ENABLED=1 \
241244
{{.CONTAINER}}:{{.CONTAINER_TAG}} \
242-
--build-cmd "{{.BUILD_COMMAND}}" \
245+
--build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \
243246
-p "{{.BUILD_PLATFORM}}"
244247
245248
tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}}

0 commit comments

Comments
 (0)