Update build.yml

This commit is contained in:
neochaos42 2025-04-16 21:26:14 -05:00 committed by GitHub
parent c5af77de9c
commit 27b1cb528e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -139,17 +139,14 @@ env:
container: | container: |
null null
job-transfer-artifact-suffix: ARM_64bit job-transfer-artifact-suffix: ARM_64bit
mergeable-channel-file: 'true' mergeable-channel-file: 'false'
artifacts: artifacts:
- path: '*Linux_arm64.zip' - path: '*ARM_64bit.tar.gz'
name: Linux_arm64_zip name: ARM_64bit_tarball
- path: '*Linux_arm64.AppImage'
name: Linux_arm64_app_image
PAID_RUNNER_BUILD_DATA: | PAID_RUNNER_BUILD_DATA: |
# This system was implemented to allow selective use of paid GitHub-hosted runners, due to the Apple Silicon runner # This system was implemented to allow selective use of paid GitHub-hosted runners, due to the Apple Silicon runner
# incurring a charge at that time. Free Apple Silicon runners are now available so the configuration was moved to # incurring a charge at that time. Free Apple Silicon runners are now available so the configuration was moved to
# `BASE_BUILD_DATA`, but the system was left in place for future use. # `BASE_BUILD_DATA`, but the system was left in place for future use.
jobs: jobs:
run-determination: run-determination:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -172,9 +169,7 @@ jobs:
# There is no need to run the other jobs. # There is no need to run the other jobs.
RESULT="false" RESULT="false"
fi fi
echo "result=$RESULT" >> $GITHUB_OUTPUT echo "result=$RESULT" >> $GITHUB_OUTPUT
build-type-determination: build-type-determination:
needs: run-determination needs: run-determination
if: needs.run-determination.outputs.result == 'true' if: needs.run-determination.outputs.result == 'true'
@ -211,13 +206,11 @@ jobs:
is_nightly="false" is_nightly="false"
channel_name="nightly" channel_name="nightly"
fi fi
echo "is-release=$is_release" >> $GITHUB_OUTPUT echo "is-release=$is_release" >> $GITHUB_OUTPUT
echo "is-nightly=$is_nightly" >> $GITHUB_OUTPUT echo "is-nightly=$is_nightly" >> $GITHUB_OUTPUT
echo "channel-name=$channel_name" >> $GITHUB_OUTPUT echo "channel-name=$channel_name" >> $GITHUB_OUTPUT
# Only attempt upload to Amazon S3 if the credentials are available. # Only attempt upload to Amazon S3 if the credentials are available.
echo "publish-to-s3=${{ secrets.AWS_ROLE_ARN != '' }}" >> $GITHUB_OUTPUT echo "publish-to-s3=${{ secrets.AWS_ROLE_ARN != '' }}" >> $GITHUB_OUTPUT
select-targets: select-targets:
needs: build-type-determination needs: build-type-determination
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -244,7 +237,6 @@ jobs:
--output-format json \ --output-format json \
'[.[].config]' '[.[].config]'
)" )"
artifact_matrix="$( artifact_matrix="$(
( (
echo "${{ env.BASE_BUILD_DATA }}"; echo "${{ env.BASE_BUILD_DATA }}";
@ -254,11 +246,9 @@ jobs:
--output-format json \ --output-format json \
'map(.artifacts[] + (.config | pick(["job-transfer-artifact-suffix"])))' 'map(.artifacts[] + (.config | pick(["job-transfer-artifact-suffix"])))'
)" )"
# The build matrix produces two macOS jobs (x86 and ARM) so the "channel update info files" # The build matrix produces two macOS jobs (x86 and ARM) so the "channel update info files"
# generated by each must be merged. # generated by each must be merged.
merge_channel_files="true" merge_channel_files="true"
else else
build_matrix="$( build_matrix="$(
echo "${{ env.BASE_BUILD_DATA }}" | \ echo "${{ env.BASE_BUILD_DATA }}" | \
@ -266,31 +256,25 @@ jobs:
--output-format json \ --output-format json \
'[.[].config]' '[.[].config]'
)" )"
artifact_matrix="$( artifact_matrix="$(
echo "${{ env.BASE_BUILD_DATA }}" | \ echo "${{ env.BASE_BUILD_DATA }}" | \
yq \ yq \
--output-format json \ --output-format json \
'map(.artifacts[] + (.config | pick(["job-transfer-artifact-suffix"])))' 'map(.artifacts[] + (.config | pick(["job-transfer-artifact-suffix"])))'
)" )"
merge_channel_files="false" merge_channel_files="false"
fi fi
# Set workflow step outputs. # Set workflow step outputs.
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings # See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
delimiter="$RANDOM" delimiter="$RANDOM"
echo "build-matrix<<$delimiter" >> $GITHUB_OUTPUT echo "build-matrix<<$delimiter" >> $GITHUB_OUTPUT
echo "$build_matrix" >> $GITHUB_OUTPUT echo "$build_matrix" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT
delimiter="$RANDOM" delimiter="$RANDOM"
echo "artifact-matrix<<$delimiter" >> $GITHUB_OUTPUT echo "artifact-matrix<<$delimiter" >> $GITHUB_OUTPUT
echo "$artifact_matrix" >> $GITHUB_OUTPUT echo "$artifact_matrix" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT
echo "merge-channel-files=$merge_channel_files" >> $GITHUB_OUTPUT echo "merge-channel-files=$merge_channel_files" >> $GITHUB_OUTPUT
build: build:
name: build (${{ matrix.config.name }}) name: build (${{ matrix.config.name }})
needs: needs:
@ -331,7 +315,6 @@ jobs:
if: runner.os == 'Windows' && matrix.config.working-directory if: runner.os == 'Windows' && matrix.config.working-directory
run: | run: |
if not exist "${{ matrix.config.working-directory }}" mklink /d "${{ matrix.config.working-directory }}" "C:\actions-runner\_work\arduino-ide\arduino-ide" if not exist "${{ matrix.config.working-directory }}" mklink /d "${{ matrix.config.working-directory }}" "C:\actions-runner\_work\arduino-ide\arduino-ide"
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -352,7 +335,6 @@ jobs:
install \ install \
--global \ --global \
"yarn@${{ env.YARN_VERSION }}" "yarn@${{ env.YARN_VERSION }}"
- name: Install Python 3.x - name: Install Python 3.x
if: fromJSON(matrix.config.container) == null && runner.name != 'WINDOWS-SIGN-PC' if: fromJSON(matrix.config.container) == null && runner.name != 'WINDOWS-SIGN-PC'
uses: actions/setup-python@v5 uses: actions/setup-python@v5
@ -392,15 +374,12 @@ jobs:
export CSC_KEY_PASSWORD="${{ secrets[matrix.config.certificate-password-secret] }}" export CSC_KEY_PASSWORD="${{ secrets[matrix.config.certificate-password-secret] }}"
export CSC_FOR_PULL_REQUEST=true export CSC_FOR_PULL_REQUEST=true
fi fi
npx node-gyp install npx node-gyp install
yarn install yarn install
yarn --cwd arduino-ide-extension build yarn --cwd arduino-ide-extension build
yarn --cwd electron-app rebuild yarn --cwd electron-app rebuild
yarn --cwd electron-app build yarn --cwd electron-app build
yarn --cwd electron-app package yarn --cwd electron-app package
# Both macOS jobs generate a "channel update info file" with same path and name. The second job to complete would # Both macOS jobs generate a "channel update info file" with same path and name. The second job to complete would
# overwrite the file generated by the first in the workflow artifact. # overwrite the file generated by the first in the workflow artifact.
- name: Stage channel file for merge - name: Stage channel file for merge
@ -414,11 +393,9 @@ jobs:
mv \ mv \
"${{ env.BUILD_ARTIFACTS_PATH }}/${{ needs.build-type-determination.outputs.channel-name }}-mac.yml" \ "${{ env.BUILD_ARTIFACTS_PATH }}/${{ needs.build-type-determination.outputs.channel-name }}-mac.yml" \
"${staged_channel_files_path}/${{ needs.build-type-determination.outputs.channel-name }}-mac-${{ runner.arch }}.yml" "${staged_channel_files_path}/${{ needs.build-type-determination.outputs.channel-name }}-mac-${{ runner.arch }}.yml"
# Set workflow environment variable for use in other steps. # Set workflow environment variable for use in other steps.
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable # See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
echo "STAGED_CHANNEL_FILES_PATH=$staged_channel_files_path" >> "$GITHUB_ENV" echo "STAGED_CHANNEL_FILES_PATH=$staged_channel_files_path" >> "$GITHUB_ENV"
- name: Upload staged-for-merge channel file artifact - name: Upload staged-for-merge channel file artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: > if: >
@ -440,7 +417,6 @@ jobs:
shell: cmd shell: cmd
run: | run: |
rmdir /s /q "${{ matrix.config.working-directory }}\${{ env.BUILD_ARTIFACTS_PATH }}" rmdir /s /q "${{ matrix.config.working-directory }}\${{ env.BUILD_ARTIFACTS_PATH }}"
merge-channel-files: merge-channel-files:
needs: needs:
- build-type-determination - build-type-determination
@ -454,7 +430,6 @@ jobs:
run: | run: |
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable # See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
echo "CHANNEL_FILES_PATH=${{ runner.temp }}/channel-files" >> "$GITHUB_ENV" echo "CHANNEL_FILES_PATH=${{ runner.temp }}/channel-files" >> "$GITHUB_ENV"
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -493,7 +468,6 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev libsecret-1-dev sudo apt-get install -y libx11-dev libxkbfile-dev libsecret-1-dev
- name: Install dependencies - name: Install dependencies
run: yarn run: yarn
@ -503,7 +477,6 @@ jobs:
./scripts/merge-channel-files.js \ ./scripts/merge-channel-files.js \
--channel "${{ needs.build-type-determination.outputs.channel-name }}" \ --channel "${{ needs.build-type-determination.outputs.channel-name }}" \
--input "${{ env.CHANNEL_FILES_PATH }}" --input "${{ env.CHANNEL_FILES_PATH }}"
- name: Upload merged channel files job transfer artifact - name: Upload merged channel files job transfer artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -570,16 +543,13 @@ jobs:
fi fi
fi fi
echo -e "$BODY" echo -e "$BODY"
# Set workflow step output # Set workflow step output
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings # See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
DELIMITER="$RANDOM" DELIMITER="$RANDOM"
echo "BODY<<$DELIMITER" >> $GITHUB_OUTPUT echo "BODY<<$DELIMITER" >> $GITHUB_OUTPUT
echo "$BODY" >> $GITHUB_OUTPUT echo "$BODY" >> $GITHUB_OUTPUT
echo "$DELIMITER" >> $GITHUB_OUTPUT echo "$DELIMITER" >> $GITHUB_OUTPUT
echo "$BODY" > CHANGELOG.txt echo "$BODY" > CHANGELOG.txt
- name: Upload changelog job transfer artifact - name: Upload changelog job transfer artifact
if: needs.build-type-determination.outputs.is-nightly == 'true' if: needs.build-type-determination.outputs.is-nightly == 'true'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -630,7 +600,6 @@ jobs:
- name: Publish Nightly [S3] - name: Publish Nightly [S3]
run: | run: |
aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide/nightly aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide/nightly
release: release:
needs: needs:
- build-type-determination - build-type-determination
@ -668,7 +637,6 @@ jobs:
id: tag_name id: tag_name
run: | run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Publish Release [GitHub] - name: Publish Release [GitHub]
uses: svenstaro/upload-release-action@2.9.0 uses: svenstaro/upload-release-action@2.9.0
with: with:
@ -690,7 +658,6 @@ jobs:
if: needs.build-type-determination.outputs.publish-to-s3 == 'true' if: needs.build-type-determination.outputs.publish-to-s3 == 'true'
run: | run: |
aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide
clean: clean:
# This job must run after all jobs that use the transfer artifact. # This job must run after all jobs that use the transfer artifact.
needs: needs: