Skip to content

Commit

Permalink
Merge branch 'main' into maxz-sb16-sock-netposix
Browse files Browse the repository at this point in the history
  • Loading branch information
maxz-lab authored Sep 12, 2024
2 parents 72d5274 + 22b82c4 commit a5ff4d2
Show file tree
Hide file tree
Showing 1,190 changed files with 3,327 additions and 127,005 deletions.
153 changes: 153 additions & 0 deletions .github/actions/check_artifact_size/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Check Artifact Size
description: Check if the increase in artifact size exceeds the threshold, and if so, apply a label to the pull request.
inputs:
workflow:
description: "Workflow to check artifact binary size for."
required: true
name:
description: "Name of the uploaded artifact, artifact is a zip file that can contain more than one binary"
required: true
path:
description: "Path to the newly created binary artifacts being checked."
required: true
thresholds:
description: "Thresholds is a JSON-formatted string that specifies the maximum permissible percentage increase in the size of each respective binary artifact."
required: true
token:
description: "Github token needed for downloading artifacts."
required: true
runs:
using: "composite"
steps:
- name: 'Download artifact from main branch'
id: download-artifact
uses: actions/github-script@v6
with:
github-token: ${{inputs.token}}
script: |
const fs = require('fs');
const path = require('path');
// Get the latest successful workflow run on the main branch.
const workflowRuns = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: '${{ inputs.workflow }}.yaml',
branch: 'main',
status: 'success',
per_page: 1
});
const latestRun = workflowRuns.data.workflow_runs[0].id;
// Get the artifact uploaded on the latest successful workflow run on the main branch.
let allArtifacts = [];
let page = 1;
let hasNextPage = true;
while (hasNextPage) {
const response = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: latestRun,
page: page
});
allArtifacts = allArtifacts.concat(response.data.artifacts);
if (response.data.artifacts.length === 0) {
hasNextPage = false;
} else {
page++;
}
}
const matchArtifacts = allArtifacts.filter((artifact) => {
return artifact.name == '${{ inputs.name }}';
});
if (matchArtifacts.length == 1) {
console.log(`Found the latest uploaded artifact ${{ inputs.name }} on the main branch.`);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifacts[0].id,
archive_format: 'zip',
});
const downloadDir = path.join(process.env.GITHUB_WORKSPACE, 'artifact_tmp');
fs.mkdirSync(downloadDir);
fs.writeFileSync(path.join(downloadDir, `${{ inputs.name }}.zip`), Buffer.from(download.data));
core.setOutput("downloadDir", downloadDir);
} else {
core.setFailed(`Expected one artifact with name ${{ inputs.name }}. Found ${matchArtifacts.length}.`);
}
- name: 'Unzip artifact from main branch'
id: unzip-downloaded-artifact
shell: bash
run: |
unzip "${{ steps.download-artifact.outputs.downloadDir }}/${{ inputs.name }}.zip" -d "${{ steps.download-artifact.outputs.downloadDir }}"
- name: 'Check new artifact size against main branch'
id: check-artifact-size
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const path = require('path');
const fileSizeThresholds = JSON.parse('${{ inputs.thresholds }}');
for (let file in fileSizeThresholds) {
console.log(`Checking file size of ${file}.`);
const fileName = file.split('/').pop();
const downloadFilePath = path.join('${{ steps.download-artifact.outputs.downloadDir }}', fileName);
if (!fs.existsSync(downloadFilePath)) {
core.setFailed(`File ${file} was not uploaded to the main branch.`);
}
const filePath = path.join(process.env.GITHUB_WORKSPACE, '${{ inputs.path }}', file);
if (!fs.existsSync(filePath)) {
core.setFailed(`File ${file} was not created in the current workflow run.`);
}
const oldStats = fs.statSync(downloadFilePath);
const oldSize = oldStats.size;
const newStats = fs.statSync(filePath);
const newSize = newStats.size;
console.log(`Latest uploaded artifact size on the main branch is ${oldSize / 1024}kB, new artifact size generated in this PR is ${newSize / 1024}kB.`);
const deltaSize = newSize - oldSize;
const deltaThreshold = (Math.abs(deltaSize) / oldSize * 100).toFixed(1);
if (deltaSize < 0) {
console.log(`Artifact size is decreased by ${Math.abs(deltaSize)} (${deltaThreshold}%).`);
} else {
console.log(`Artifact size is increased by ${deltaSize} (${deltaThreshold}%).`);
const threshold = (fileSizeThresholds[file] * 100).toFixed(1);
if (deltaThreshold > threshold) {
console.error(`Artifact size increase exceeds threshold ${threshold}%.`);
core.setOutput("addLabel", true);
}
}
}
- name: 'Remove downloaded artifact'
id: remove-downloaded-artifact
shell: bash
run: rm -r "${{ steps.download-artifact.outputs.downloadDir }}"
- name: 'Add label for artifact size increase violation'
id: add-label
if: |
steps.check-artifact-size.outputs.addLabel &&
github.event.pull_request.merged == true &&
github.event.pull_request.merge_commit_sha != null
shell: bash
run: |
curl -s -X POST -H "Authorization: token ${{ inputs.token }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '["artifact size increase violation"]' \
"https://api.github.com/repos/${{ github.event.repository.full_name }}/issues/${{ github.event.number }}/labels"
76 changes: 0 additions & 76 deletions .github/actions/docker_win/action.yaml

This file was deleted.

28 changes: 4 additions & 24 deletions .github/config/evergreen-arm-hardfp.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
},
"platforms": [
"evergreen-arm-hardfp",
"evergreen-arm-hardfp-sbversion-14",
"evergreen-arm-hardfp-sbversion-15",
"evergreen-arm-hardfp-sbversion-16"
"evergreen-arm-hardfp-sbversion-17"
],
"includes": [
{
Expand All @@ -28,31 +26,13 @@
"dimension": "release_version=regex:10.*"
},
{
"name":"sbversion-14",
"platform":"evergreen-arm-hardfp-sbversion-14",
"name":"sbversion-17",
"platform":"evergreen-arm-hardfp-sbversion-17",
"target_platform":"evergreen-arm-hardfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"evergreen_loader_extra_gn_arguments":"use_asan=false is_clang=false",
"sb_api_version": "14"
},
{
"name":"sbversion-15",
"platform":"evergreen-arm-hardfp-sbversion-15",
"target_platform":"evergreen-arm-hardfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"evergreen_loader_extra_gn_arguments":"use_asan=false is_clang=false",
"sb_api_version": "15"
},
{
"name":"sbversion-16",
"platform":"evergreen-arm-hardfp-sbversion-16",
"target_platform":"evergreen-arm-hardfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"evergreen_loader_extra_gn_arguments":"use_asan=false is_clang=false",
"sb_api_version": "16"
"sb_api_version": "17"
}
]
}
28 changes: 4 additions & 24 deletions .github/config/evergreen-arm-softfp.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
},
"platforms": [
"evergreen-arm-softfp",
"evergreen-arm-softfp-sbversion-14",
"evergreen-arm-softfp-sbversion-15",
"evergreen-arm-softfp-sbversion-16"
"evergreen-arm-softfp-sbversion-17"
],
"includes": [
{
Expand All @@ -27,30 +25,12 @@
"evergreen_loader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
},
{
"name":"sbversion-14",
"platform":"evergreen-arm-softfp-sbversion-14",
"name":"sbversion-17",
"platform":"evergreen-arm-softfp-sbversion-17",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"14",
"evergreen_loader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
},
{
"name":"sbversion-15",
"platform":"evergreen-arm-softfp-sbversion-15",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"15",
"evergreen_loader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
},
{
"name":"sbversion-16",
"platform":"evergreen-arm-softfp-sbversion-16",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"16",
"sb_api_version":"17",
"evergreen_loader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
}
]
Expand Down
31 changes: 8 additions & 23 deletions .github/config/evergreen-arm64.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
{
"docker_service": "build-evergreen",
"docker_service": "build-android-evergreen",
"evergreen_loader": "android-arm64",
"platforms": [
"evergreen-arm64",
"evergreen-arm64-sbversion-14",
"evergreen-arm64-sbversion-15",
"evergreen-arm64-sbversion-16"
"evergreen-arm64-sbversion-17"
],
"includes": [
{
"name":"arm64",
"platform":"evergreen-arm64",
"target_platform":"evergreen-arm64",
"target_cpu":"target_cpu=\\\"arm64\\\"",
"extra_gn_arguments":"use_asan=false"
},
{
"name":"sbversion-14",
"platform":"evergreen-arm64-sbversion-14",
"target_platform":"evergreen-arm64",
"target_cpu":"target_cpu=\\\"arm64\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"14"
},
{
"name":"sbversion-15",
"platform":"evergreen-arm64-sbversion-15",
"target_platform":"evergreen-arm64",
"target_cpu":"target_cpu=\\\"arm64\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"15"
"evergreen_loader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
},
{
"name":"sbversion-16",
"platform":"evergreen-arm64-sbversion-16",
"name":"sbversion-17",
"platform":"evergreen-arm64-sbversion-17",
"target_platform":"evergreen-arm64",
"target_cpu":"target_cpu=\\\"arm64\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"16"
"sb_api_version":"17",
"evergreen_loader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
}
]
}
Loading

0 comments on commit a5ff4d2

Please sign in to comment.