Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed Dec 20, 2024
1 parent 2727f61 commit c258ea6
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1413,10 +1413,6 @@ jobs:
- store_artifacts:
path: test-artifacts
destination: test-artifacts
# important: generate lavamoat viz AFTER uploading builds as artifacts
- run:
name: build:lavamoat-viz
command: ./.circleci/scripts/create-lavamoat-viz.sh
- store_artifacts:
path: build-artifacts
destination: build-artifacts
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/build-lavamoat-viz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build LavaMoat visualization

on:
workflow_call:

jobs:
build-lavamoat-viz:
name: Build LavaMoat visualization
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup environment
uses: metamask/github-tools/.github/actions/setup-environment@main

- name: Build LavaMoat visualization
run: ./development/create-lavamoat-viz.sh

- uses: actions/upload-artifact@v4
with:
name: lavamoat-build-viz
path: ./build-artifacts/build-viz/
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ jobs:
publish-prerelease:
name: Publish prerelease
if: ${{ github.event_name == 'pull_request' }}
needs:
- wait-for-circleci-workflow-status
uses: ./.github/workflows/publish-prerelease.yml
secrets:
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,30 @@ on:
required: true

jobs:
lavamoat-build-viz:
name: Build LavaMoat build visualization
runs-on: ubuntu-latest
outputs:
ARTIFACT_ID: ${{ steps.artifact-upload-step.outputs.artifact-id }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup environment
uses: metamask/github-tools/.github/actions/setup-environment@main

- name: Build LavaMoat visualization
run: ./development/create-lavamoat-viz.sh

- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: lavamoat-build-viz
path: ./build-artifacts/build-viz/

publish-prerelease:
name: Publish prerelease
needs: lavamoat-build-viz
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -61,6 +83,12 @@ jobs:
mkdir "storybook-build"
echo "${stories}" > "storybook-build/stories.json"
- name: Download LavaMoat build visualization
uses: actions/download-artifact@v4
with:
name: lavamoat-build-viz
path: ./build-artifacts/build-viz/

- name: Publish prerelease
env:
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}
Expand All @@ -69,4 +97,5 @@ jobs:
MERGE_BASE_COMMIT_HASH: ${{ steps.get-merge-base.outputs.MERGE_BASE }}
CIRCLE_BUILD_NUM: ${{ steps.get-circleci-job-details.outputs.CIRCLE_BUILD_NUM }}
CIRCLE_WORKFLOW_JOB_ID: ${{ steps.get-circleci-job-details.outputs.CIRCLE_WORKFLOW_JOB_ID }}
LAVAMOAT_BUILD_VIZ_ID: ${{needs.lavamoat-build-viz.outputs.ARTIFACT_ID}}
run: ./development/metamaskbot-build-announce.js
File renamed without changes.
4 changes: 3 additions & 1 deletion development/metamaskbot-build-announce.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ async function start() {
MERGE_BASE_COMMIT_HASH,
CIRCLE_BUILD_NUM,
CIRCLE_WORKFLOW_JOB_ID,
LAVAMOAT_BUILD_VIZ_ID,
} = process.env;

console.log('PR_NUMBER', PR_NUMBER);
console.log('HEAD_COMMIT_HASH', HEAD_COMMIT_HASH);
console.log('MERGE_BASE_COMMIT_HASH', MERGE_BASE_COMMIT_HASH);
console.log('CIRCLE_BUILD_NUM', CIRCLE_BUILD_NUM);
console.log('CIRCLE_WORKFLOW_JOB_ID', CIRCLE_WORKFLOW_JOB_ID);
console.log('LAVAMOAT_BUILD_VIZ_ID', LAVAMOAT_BUILD_VIZ_ID);

if (!PR_NUMBER) {
console.warn(`No pull request detected for commit "${HEAD_COMMIT_HASH}"`);
Expand Down Expand Up @@ -165,7 +167,7 @@ async function start() {
const tsMigrationDashboardLink = `<a href="${tsMigrationDashboardUrl}">Dashboard</a>`;

// links to bundle browser builds
const depVizUrl = `${BUILD_LINK_BASE}/build-artifacts/build-viz/index.html`;
const depVizUrl = `https://api.github.com/repos/MetaMask/metamask-extension/actions/artifacts/${LAVAMOAT_BUILD_VIZ_ID}/zip`;
const depVizLink = `<a href="${depVizUrl}">Build System</a>`;
const moduleInitStatsBackgroundUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/initialisation/background/index.html`;
const moduleInitStatsBackgroundLink = `<a href="${moduleInitStatsBackgroundUrl}">Background Module Init Stats</a>`;
Expand Down

0 comments on commit c258ea6

Please sign in to comment.