From fee04b4fd79993c47eaddf59b505087547a9151e Mon Sep 17 00:00:00 2001 From: EnderDev Date: Fri, 7 Jul 2023 15:24:21 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20build-ff=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-ff.yml | 85 ---------------------------------- src/compare-versions.js | 29 ------------ src/set-run-state.js | 49 -------------------- 3 files changed, 163 deletions(-) delete mode 100644 .github/workflows/build-ff.yml delete mode 100644 src/set-run-state.js diff --git a/.github/workflows/build-ff.yml b/.github/workflows/build-ff.yml deleted file mode 100644 index ad7a073..0000000 --- a/.github/workflows/build-ff.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: "Build Firefox" - -on: - workflow_dispatch: - inputs: - sha: - description: "Revision to build from" - required: true - type: string - -env: - SCCACHE_VERSION: "0.5.4" - -jobs: - build: - strategy: - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Set initial environment - run: | - echo "START_TIME_MS=$(($(date +%s%N)/1000000))" >> "$GITHUB_ENV" - echo "FF_VERSION=$(curl https://raw.githubusercontent.com/dothq/gecko-dev/${{ inputs.sha }}/browser/config/version.txt)" >> "$GITHUB_ENV" - - - name: Clone scripts repository - run: | - git clone --depth 1 ${{ github.server_url }}/${{ github.repository }} ~/gd-scripts - cd ~/gd-scripts && npm install - - - name: Get current job ID - uses: Tiryoh/gha-jobid-action@41f11aceecb8afcc9a3d9383242b9bad5a7a7cc3 - id: jobs - with: - github_token: ${{ secrets.ROBOT_TOKEN }} - job_name: "${{ github.job }} (${{ matrix.os }})" - - - name: Update run state - env: - GH_APP_ID: ${{ secrets.GH_APP_ID }} - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - RUN_NAME: "${{ github.job }} (${{ matrix.os }})" - HEAD_SHA: ${{ inputs.sha }} - DETAILS_URL: https://workflow-redir.dev.dothq.org/api/go?run_id=${{ github.run_id }}&job_id=${{ steps.jobs.outputs.job_id }} - VERSION: ${{ env.FF_VERSION }} - run: node ~/gd-scripts/src/set-run-state.js - - - name: Checkout source tree - uses: actions/checkout@v3 - with: - repository: dothq/gecko-dev - ref: ${{ inputs.sha }} - - - name: Install dependencies - run: | - sudo apt-get install -y curl \ - python3 \ - python3-pip - curl -L https://github.com/mozilla/sccache/releases/download/v${{ env.SCCACHE_VERSION }}/sccache-v${{ env.SCCACHE_VERSION }}-$(uname -m)-unknown-linux-musl.tar.gz | tar -xzf - - sudo mv sccache-v${{ env.SCCACHE_VERSION }}-$(uname -m)-unknown-linux-musl/sccache /usr/local/bin/ - ./mach --no-interactive bootstrap --application-choice browser - - - name: Configure the build - run: | - touch mozconfig - echo "ac_add_options --with-ccache=sccache" >> mozconfig - - - name: Build the source tree - id: build - continue-on-error: true - run: | - echo "Compilation started at $(date '+%a %d %b %Y %H:%M:%S %Z')." - ./mach build >/dev/null - - - name: Update run state - timeout-minutes: 5 - if: always() - env: - GH_APP_ID: ${{ secrets.GH_APP_ID }} - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - CONCLUSION: ${{ steps.build.outcome }} - START_TIME_MS: ${{ env.START_TIME_MS }} - RUN_NAME: "${{ github.job }} (${{ matrix.os }})" - VERSION: ${{ env.FF_VERSION }} - run: node ~/gd-scripts/src/set-run-state.js \ No newline at end of file diff --git a/src/compare-versions.js b/src/compare-versions.js index 681fdd3..9f03a2e 100644 --- a/src/compare-versions.js +++ b/src/compare-versions.js @@ -64,33 +64,4 @@ async function main() { console.log("Pull request has been made.") - const scriptsRepo = await gh.request("GET /repos/{owner}/{repo}", { - owner: "dothq", - repo: "gecko-dev-scripts" - }); - - const workflows = await gh.request("GET /repos/{owner}/{repo}/actions/workflows", { - owner: "dothq", - repo: "gecko-dev-scripts", - }); - - const buildWorkflowId = workflows.data.workflows.find(w => w.path.endsWith("/build-ff.yml")).id; - - if (!buildWorkflowId) { - throw new Error("No build-ff workflow!"); - } - - await gh.request("POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", { - owner: "dothq", - repo: "gecko-dev-scripts", - workflow_id: buildWorkflowId, - ref: scriptsRepo.data.default_branch, - inputs: { - sha: pr.data.head.sha - } - }); - - console.log("Build dispatch is in progress...") -} - main(); \ No newline at end of file diff --git a/src/set-run-state.js b/src/set-run-state.js deleted file mode 100644 index 4ef9ee9..0000000 --- a/src/set-run-state.js +++ /dev/null @@ -1,49 +0,0 @@ -import ms from "ms"; -import { createGHApp } from "./shared/github.js"; -import { existsSync, readFileSync, writeFileSync } from "fs"; -import { resolve } from "path"; -import { homedir } from "os"; - -const main = async () => { - const app = createGHApp(); - - const installation = await app.octokit.request("GET /repos/{owner}/{repo}/installation", { - owner: "dothq", - repo: "gecko-dev" - }); - - const octokit = await app.getInstallationOctokit(installation.data.id); - - if (existsSync(resolve(homedir(), "run_id"))) { - await octokit.request("PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}", { - owner: "dothq", - repo: "gecko-dev", - check_run_id: readFileSync(resolve(homedir(), "run_id"), "utf-8").trim(), - conclusion: process.env.CONCLUSION, - status: "completed", - output: { - title: process.env.CONCLUSION == "success" - ? `Firefox v${process.env.VERSION} was successfully compiled in ${ms(Date.now() - process.env.START_TIME_MS)}` - : `Failed to compile. Click 'Details' for more information.`, - summary: "" - } - }); - } else { - const run = await octokit.request("POST /repos/{owner}/{repo}/check-runs", { - owner: "dothq", - repo: "gecko-dev", - name: process.env.RUN_NAME, - head_sha: process.env.HEAD_SHA, - details_url: process.env.DETAILS_URL, - status: "in_progress", - output: { - title: `Compiling Firefox v${process.env.VERSION}...`, - summary: "" - } - }); - - writeFileSync(resolve(homedir(), "run_id"), run.data.id.toString(), "utf-8"); - } -} - -main(); \ No newline at end of file