From d08a4fc65f69db8496ab7316415c1d57796c2206 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Mon, 22 Apr 2024 13:42:19 +0300 Subject: [PATCH 01/10] test build on github actions --- .github/workflows/build.yml | 76 +++++++++++++++++++++++++++++++++++++ bamboo-specs/build.yaml | 4 +- bamboo-specs/tests.yaml | 19 ++++++++-- 3 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5ca0a45 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,76 @@ +# Builds project +name: Build + +env: + NODE_VERSION: 20 + +on: + workflow_dispatch: + inputs: + id: + type: 'string' + description: 'Unique identifier for the workflow run. Needed for github-actions-runner' + +## Required for github-actions-runner +run-name: ${{github.workflow}} [ID:${{ inputs.id }}] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # Number of commits to fetch. 0 indicates all history. + fetch-depth: 0 + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + - name: Setup Node.js environment + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: pnpm + - name: Run bash commands + shell: bash + run: | + ls -alt + + # Install deps + pnpm install + + pnpm lint + pnpm test + + pnpm pack && mv adguard-github-actions-runner-*.tgz github-actions-runner.tgz + - name: Save dist artifact + uses: actions/upload-artifact@v4 + with: + name: github-actions-runner.tgz + path: ./github-actions-runner.tgz + notify: + needs: test + # Run this job only if the previous job failed and the event was triggered by the 'AdguardTeam/GithubActionsRunner' repository + # Note: 'always()' is needed to run the notify job even if the test job was failed + if: + ${{ + always() && + needs.test.result == 'failure' && + github.repository == 'AdguardTeam/GithubActionsRunner' && + ( + github.event_name == 'push' || + github.event.pull_request.head.repo.full_name == github.repository + ) + }} + runs-on: ubuntu-latest + steps: + - name: Send Slack notification + uses: 8398a7/action-slack@v3 + with: + status: failure + fields: workflow, repo, message, commit, author, eventName, ref, job + job_name: test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/bamboo-specs/build.yaml b/bamboo-specs/build.yaml index 9e73af9..ecd7330 100644 --- a/bamboo-specs/build.yaml +++ b/bamboo-specs/build.yaml @@ -76,14 +76,14 @@ Build: shared: true required: true requirements: - - adg-docker: 'true' + - adg-docker: true triggers: [] branches: create: manually delete: never - link-to-jira: 'true' + link-to-jira: true notifications: - events: diff --git a/bamboo-specs/tests.yaml b/bamboo-specs/tests.yaml index ae9b4f9..71f650f 100644 --- a/bamboo-specs/tests.yaml +++ b/bamboo-specs/tests.yaml @@ -21,7 +21,7 @@ Test: docker: image: ${bamboo.dockerNode} volumes: - ${system.PNPM_DIR}: "${bamboo.cachePnpm}" + ${system.PNPM_DIR}: ${bamboo.cachePnpm} tasks: - checkout: force-clean-build: true @@ -40,9 +40,15 @@ Test: # Set cache directory pnpm config set store-dir ${bamboo.cachePnpm} + # FIXME Remove after github-actions-runner will be in the docker image pnpm install - pnpm lint - pnpm test + pnpm build + + branch="${bamboo_planRepository_branchName}" + revision="${bamboo_planRepository_revision}" + + # FIXME use github-actions-runner binary after it will be exposed in the docker + node dist/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow build.yml --artifacts-path . final-tasks: - script: interpreter: SHELL @@ -59,8 +65,13 @@ Test: echo "Size before cleanup:" && du -h | tail -n 1 rm -rf node_modules echo "Size after cleanup:" && du -h | tail -n 1 + artifacts: + - name: github-actions-runner.tgz + pattern: github-actions-runner.tgz + shared: true + required: true requirements: - - adg-docker: true + - adg-docker: 'true' branches: create: for-pull-request From 074aef47d1dd2adb63e88bcccde32778145cbdb5 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Mon, 22 Apr 2024 13:45:50 +0300 Subject: [PATCH 02/10] fix path --- bamboo-specs/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bamboo-specs/tests.yaml b/bamboo-specs/tests.yaml index 71f650f..19ca66f 100644 --- a/bamboo-specs/tests.yaml +++ b/bamboo-specs/tests.yaml @@ -48,7 +48,7 @@ Test: revision="${bamboo_planRepository_revision}" # FIXME use github-actions-runner binary after it will be exposed in the docker - node dist/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow build.yml --artifacts-path . + node dist/bin/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow build.yml --artifacts-path . final-tasks: - script: interpreter: SHELL From 47add050845040064aa586d150d62074e78b5185 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Mon, 22 Apr 2024 16:49:50 +0300 Subject: [PATCH 03/10] set gh token --- bamboo-specs/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bamboo-specs/tests.yaml b/bamboo-specs/tests.yaml index 19ca66f..3503ef6 100644 --- a/bamboo-specs/tests.yaml +++ b/bamboo-specs/tests.yaml @@ -48,7 +48,7 @@ Test: revision="${bamboo_planRepository_revision}" # FIXME use github-actions-runner binary after it will be exposed in the docker - node dist/bin/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow build.yml --artifacts-path . + GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} node dist/bin/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow build.yml --artifacts-path . final-tasks: - script: interpreter: SHELL From 1a383d5fae53172113484b9f28e4df96ed73e8c6 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Mon, 22 Apr 2024 19:58:41 +0300 Subject: [PATCH 04/10] show action --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ca0a45..3dd8519 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,10 @@ on: id: type: 'string' description: 'Unique identifier for the workflow run. Needed for github-actions-runner' + # FIXME remove, needed only for appearing in the Actions tab + push: + branches: + - 'feature/AG-32057' ## Required for github-actions-runner run-name: ${{github.workflow}} [ID:${{ inputs.id }}] From 8a751ea94c8411869e02fa7b1b6fae3abad65a2a Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Mon, 22 Apr 2024 20:33:50 +0300 Subject: [PATCH 05/10] fix eslint error --- src/lib/github/GithubApiClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/github/GithubApiClient.ts b/src/lib/github/GithubApiClient.ts index d8892f1..f2b27a7 100644 --- a/src/lib/github/GithubApiClient.ts +++ b/src/lib/github/GithubApiClient.ts @@ -95,7 +95,7 @@ export class GithubApiClient { * @returns A promise that resolves to the dispatch event creation response. */ async createDispatchEvent(workflow: string, branch: string, workflowRunCustomId: string): - Promise { + Promise { return this.octokit.request('POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches', { owner: this.owner, repo: this.repo, From 5cdb23ba014c90d3ec2fff2d72bb601902269867 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Mon, 22 Apr 2024 20:38:42 +0300 Subject: [PATCH 06/10] fail test --- __tests__/index.test.ts | 2 +- jest.config.ts | 1 + package.json | 2 +- src/lib/github/GithubApiClient.ts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 32ebbd9..85af000 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,6 +1,6 @@ // TODO tests describe('index', () => { it('should work', () => { - expect(1 + 2).toBe(3); + expect(1 + 2).toBe(4); }); }); diff --git a/jest.config.ts b/jest.config.ts index 6d6062b..a8e3d9d 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,4 +1,5 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', + modulePathIgnorePatterns: ['smoke'], }; diff --git a/package.json b/package.json index d0f24bf..954738d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "prepack": "pnpm build", "watch": "rollup -c rollup.config.ts --configPlugin typescript --watch", "build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript && pnpm build:types", - "test": "pnpm run test:smoke", + "test": "pnpm run test:smoke && jest", "lint": "eslint --cache . && tsc -p tsconfig.eslint.json --noEmit", "build:types": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --outdir dist/types --rootDir src", "build:txt": "ts-node scripts/build-txt", diff --git a/src/lib/github/GithubApiClient.ts b/src/lib/github/GithubApiClient.ts index f2b27a7..d8892f1 100644 --- a/src/lib/github/GithubApiClient.ts +++ b/src/lib/github/GithubApiClient.ts @@ -95,7 +95,7 @@ export class GithubApiClient { * @returns A promise that resolves to the dispatch event creation response. */ async createDispatchEvent(workflow: string, branch: string, workflowRunCustomId: string): - Promise { + Promise { return this.octokit.request('POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches', { owner: this.owner, repo: this.repo, From 58eb6c6bd59ae014114d85221a122c3fe82c8695 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Mon, 22 Apr 2024 20:40:48 +0300 Subject: [PATCH 07/10] use real start time --- src/lib/github/GithubApiManager.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/lib/github/GithubApiManager.ts b/src/lib/github/GithubApiManager.ts index acb155e..db6f7a9 100644 --- a/src/lib/github/GithubApiManager.ts +++ b/src/lib/github/GithubApiManager.ts @@ -270,18 +270,12 @@ export class GithubApiManager { /** * Logs how much time has passed since the workflow run started. - * @param workflowRun The workflow run info to log the time for. + * @param workflowRun The workflow run to log the status of. + * @param startTime The time when the workflow run started. */ - private static logHowMuchTimePassed(workflowRun: WorkflowRun): void { - if (!workflowRun.run_started_at) { - // impossible here, since we log after workflow run has started - logger.error(`Workflow run has not started yet, status: ${workflowRun.status}}`); - return; - } - - const startedAt = workflowRun.run_started_at; + private static logHowMuchTimePassed(workflowRun: WorkflowRun, startTime: number): void { const currentTime = new Date(); - const workflowStartTime = new Date(startedAt); + const workflowStartTime = new Date(startTime); const durationSeconds = Math.floor((currentTime.getTime() - workflowStartTime.getTime()) / 1000); // Log the time the build has been running and its current status @@ -334,7 +328,7 @@ export class GithubApiManager { const checkIfWorkflowRunCompleted = async (): Promise => { const workflowRun = await this.getWorkflowRun(branch, customWorkflowRunId); if (workflowRun) { - GithubApiManager.logHowMuchTimePassed(workflowRun); + GithubApiManager.logHowMuchTimePassed(workflowRun, startTime); if (workflowRun.status) { if (!IN_PROGRESS_STATUSES[workflowRun.status as keyof Statuses]) { From c8927aced3287ce904f40a54aa50c8612391aa47 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Tue, 23 Apr 2024 12:11:59 +0300 Subject: [PATCH 08/10] fail if workflow run was broken or if no artifacts found --- src/lib/GitHubActionsRunner.ts | 7 ++++++- src/lib/github/GithubApiManager.ts | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/GitHubActionsRunner.ts b/src/lib/GitHubActionsRunner.ts index 693aae2..66f47a9 100644 --- a/src/lib/GitHubActionsRunner.ts +++ b/src/lib/GitHubActionsRunner.ts @@ -1,5 +1,5 @@ import { GithubApiClient } from './github/GithubApiClient'; -import { GithubApiManager } from './github/GithubApiManager'; +import { GithubApiManager, WORKFLOW_RUN_SUCCESSFUL_CONCLUSION_STATUS } from './github/GithubApiManager'; import { logger, setLoggerLevel } from './utils/logger'; /** @@ -183,7 +183,12 @@ export class GitHubActionsRunner { const logs = await this.githubApiManager.fetchWorkflowRunLogs(workflowRun.id); logger.info(logs); + if (workflowRun.conclusion !== WORKFLOW_RUN_SUCCESSFUL_CONCLUSION_STATUS) { + throw new Error(`Workflow run failed with conclusion "${workflowRun.conclusion}".`); + } + if (artifactsPath) { + // if no artifacts are found, the method will throw an error await this.githubApiManager.downloadArtifacts(workflowRun, artifactsPath); } } diff --git a/src/lib/github/GithubApiManager.ts b/src/lib/github/GithubApiManager.ts index db6f7a9..b732d45 100644 --- a/src/lib/github/GithubApiManager.ts +++ b/src/lib/github/GithubApiManager.ts @@ -20,6 +20,8 @@ type WorkflowRun = WorkflowRuns[number]; type Artifacts = RestEndpointMethodTypes['actions']['listWorkflowRunArtifacts']['response']['data']['artifacts']; type Artifact = Artifacts[number]; +export const WORKFLOW_RUN_SUCCESSFUL_CONCLUSION_STATUS = 'success'; + /** * Statuses for a workflow run, indicating state of the workflow in the progress. */ @@ -439,11 +441,21 @@ export class GithubApiManager { * @param workflowRun The workflow run to download artifacts from. * @param artifactsPath The path to save the downloaded artifacts. * @returns A promise that resolves when all artifacts are downloaded. - * @throws An error if the download fails. + * @throws An error if the download fails or no artifacts are found. */ async downloadArtifacts(workflowRun: WorkflowRun, artifactsPath: string): Promise { logger.info('Downloading artifacts...'); + const artifactsList = await this.listWorkflowArtifacts(workflowRun.id); + + /** + * This method is called only when an artifacts path is provided, indicating that artifacts are expected. + * Consequently, if no artifacts are found, an error should be thrown. + */ + if (artifactsList.length === 0) { + throw new Error('No artifacts found'); + } + logger.info(`Artifacts found: ${artifactsList.map((artifact) => artifact.name).join(', ')}`); await Promise.all(artifactsList.map((artifact) => { From 59172249bacea41aac7a11bf8decab844082cc74 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Tue, 23 Apr 2024 14:03:51 +0300 Subject: [PATCH 09/10] add test --- __tests__/index.test.ts | 6 - __tests__/lib/github/GithubApiManager.test.ts | 17 ++ jest.config.ts | 5 +- package.json | 5 +- pnpm-lock.yaml | 209 +++++++++++++----- src/lib/GitHubActionsRunner.ts | 2 +- src/lib/github/GithubApiManager.ts | 10 +- 7 files changed, 188 insertions(+), 66 deletions(-) delete mode 100644 __tests__/index.test.ts create mode 100644 __tests__/lib/github/GithubApiManager.test.ts diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts deleted file mode 100644 index 85af000..0000000 --- a/__tests__/index.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -// TODO tests -describe('index', () => { - it('should work', () => { - expect(1 + 2).toBe(4); - }); -}); diff --git a/__tests__/lib/github/GithubApiManager.test.ts b/__tests__/lib/github/GithubApiManager.test.ts new file mode 100644 index 0000000..5bc9c8e --- /dev/null +++ b/__tests__/lib/github/GithubApiManager.test.ts @@ -0,0 +1,17 @@ +import { GithubApiManager } from '../../../src/lib/github/GithubApiManager'; +import { GithubApiClient } from '../../../src/lib/github/GithubApiClient'; + +// Silence logger output +jest.mock('../../../src/lib/utils/logger'); + +describe('GithubApiManager', () => { + describe('downloadArtifacts', () => { + it('throws error if no artifacts found', async () => { + const githubApiClient = new GithubApiClient('test', 'test', 'test'); + githubApiClient.listWorkflowArtifacts = jest.fn().mockResolvedValue({ data: { artifacts: [] } }); + + const githubApiManager = new GithubApiManager(githubApiClient); + await expect(githubApiManager.downloadArtifacts({ id: 1 }, 'test')).rejects.toThrow('No artifacts found'); + }); + }); +}); diff --git a/jest.config.ts b/jest.config.ts index a8e3d9d..50e637a 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,5 +1,8 @@ module.exports = { - preset: 'ts-jest', + transform: { + '^.+\\.(t|j)sx?$': '@swc/jest', + }, testEnvironment: 'node', modulePathIgnorePatterns: ['smoke'], + transformIgnorePatterns: ['node_modules/(?!(.*(nanoid))/)'], // since pnpm uses symlinks, we add `.*` to the path }; diff --git a/package.json b/package.json index 954738d..cc9aafa 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "prepack": "pnpm build", "watch": "rollup -c rollup.config.ts --configPlugin typescript --watch", "build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript && pnpm build:types", - "test": "pnpm run test:smoke && jest", + "test": "jest", "lint": "eslint --cache . && tsc -p tsconfig.eslint.json --noEmit", "build:types": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --outdir dist/types --rootDir src", "build:txt": "ts-node scripts/build-txt", @@ -65,6 +65,8 @@ "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-typescript": "^11.1.6", + "@swc/core": "^1.4.17", + "@swc/jest": "^0.2.36", "@types/fs-extra": "^11.0.4", "@types/jest": "^29.5.12", "@types/node": "^20.12.7", @@ -79,7 +81,6 @@ "jest": "^29.7.0", "rimraf": "^5.0.5", "rollup": "^4.14.3", - "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tslib": "^2.6.2", "typescript": "^5.4.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3ccc33..4cea5a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,6 +49,12 @@ devDependencies: '@rollup/plugin-typescript': specifier: ^11.1.6 version: 11.1.6(rollup@4.14.3)(tslib@2.6.2)(typescript@5.4.5) + '@swc/core': + specifier: ^1.4.17 + version: 1.4.17 + '@swc/jest': + specifier: ^0.2.36 + version: 0.2.36(@swc/core@1.4.17) '@types/fs-extra': specifier: ^11.0.4 version: 11.0.4 @@ -91,12 +97,9 @@ devDependencies: rollup: specifier: ^4.14.3 version: 4.14.3 - ts-jest: - specifier: ^29.1.2 - version: 29.1.2(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.4.5) ts-node: specifier: ^10.9.2 - version: 10.9.2(@types/node@20.12.7)(typescript@5.4.5) + version: 10.9.2(@swc/core@1.4.17)(@types/node@20.12.7)(typescript@5.4.5) tslib: specifier: ^2.6.2 version: 2.6.2 @@ -618,6 +621,13 @@ packages: - ts-node dev: true + /@jest/create-cache-key-function@29.7.0: + resolution: {integrity: sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/types': 29.6.3 + dev: true + /@jest/environment@29.7.0: resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -1376,6 +1386,143 @@ packages: '@sinonjs/commons': 3.0.1 dev: true + /@swc/core-darwin-arm64@1.4.17: + resolution: {integrity: sha512-HVl+W4LezoqHBAYg2JCqR+s9ife9yPfgWSj37iIawLWzOmuuJ7jVdIB7Ee2B75bEisSEKyxRlTl6Y1Oq3owBgw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@swc/core-darwin-x64@1.4.17: + resolution: {integrity: sha512-WYRO9Fdzq4S/he8zjW5I95G1zcvyd9yyD3Tgi4/ic84P5XDlSMpBDpBLbr/dCPjmSg7aUXxNQqKqGkl6dQxYlA==} + engines: {node: '>=10'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm-gnueabihf@1.4.17: + resolution: {integrity: sha512-cgbvpWOvtMH0XFjvwppUCR+Y+nf6QPaGu6AQ5hqCP+5Lv2zO5PG0RfasC4zBIjF53xgwEaaWmGP5/361P30X8Q==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm64-gnu@1.4.17: + resolution: {integrity: sha512-l7zHgaIY24cF9dyQ/FOWbmZDsEj2a9gRFbmgx2u19e3FzOPuOnaopFj0fRYXXKCmtdx+anD750iBIYnTR+pq/Q==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm64-musl@1.4.17: + resolution: {integrity: sha512-qhH4gr9gAlVk8MBtzXbzTP3BJyqbAfUOATGkyUtohh85fPXQYuzVlbExix3FZXTwFHNidGHY8C+ocscI7uDaYw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-x64-gnu@1.4.17: + resolution: {integrity: sha512-vRDFATL1oN5oZMImkwbgSHEkp8xG1ofEASBypze01W1Tqto8t+yo6gsp69wzCZBlxldsvPpvFZW55Jq0Rn+UnA==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-x64-musl@1.4.17: + resolution: {integrity: sha512-zQNPXAXn3nmPqv54JVEN8k2JMEcMTQ6veVuU0p5O+A7KscJq+AGle/7ZQXzpXSfUCXlLMX4wvd+rwfGhh3J4cw==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-arm64-msvc@1.4.17: + resolution: {integrity: sha512-z86n7EhOwyzxwm+DLE5NoLkxCTme2lq7QZlDjbQyfCxOt6isWz8rkW5QowTX8w9Rdmk34ncrjSLvnHOeLY17+w==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-ia32-msvc@1.4.17: + resolution: {integrity: sha512-JBwuSTJIgiJJX6wtr4wmXbfvOswHFj223AumUrK544QV69k60FJ9q2adPW9Csk+a8wm1hLxq4HKa2K334UHJ/g==} + engines: {node: '>=10'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-x64-msvc@1.4.17: + resolution: {integrity: sha512-jFkOnGQamtVDBm3MF5Kq1lgW8vx4Rm1UvJWRUfg+0gx7Uc3Jp3QMFeMNw/rDNQYRDYPG3yunCC+2463ycd5+dg==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core@1.4.17: + resolution: {integrity: sha512-tq+mdWvodMBNBBZbwFIMTVGYHe9N7zvEaycVVjfvAx20k1XozHbHhRv+9pEVFJjwRxLdXmtvFZd3QZHRAOpoNQ==} + engines: {node: '>=10'} + requiresBuild: true + peerDependencies: + '@swc/helpers': ^0.5.0 + peerDependenciesMeta: + '@swc/helpers': + optional: true + dependencies: + '@swc/counter': 0.1.3 + '@swc/types': 0.1.6 + optionalDependencies: + '@swc/core-darwin-arm64': 1.4.17 + '@swc/core-darwin-x64': 1.4.17 + '@swc/core-linux-arm-gnueabihf': 1.4.17 + '@swc/core-linux-arm64-gnu': 1.4.17 + '@swc/core-linux-arm64-musl': 1.4.17 + '@swc/core-linux-x64-gnu': 1.4.17 + '@swc/core-linux-x64-musl': 1.4.17 + '@swc/core-win32-arm64-msvc': 1.4.17 + '@swc/core-win32-ia32-msvc': 1.4.17 + '@swc/core-win32-x64-msvc': 1.4.17 + dev: true + + /@swc/counter@0.1.3: + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + dev: true + + /@swc/jest@0.2.36(@swc/core@1.4.17): + resolution: {integrity: sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==} + engines: {npm: '>= 7.0.0'} + peerDependencies: + '@swc/core': '*' + dependencies: + '@jest/create-cache-key-function': 29.7.0 + '@swc/core': 1.4.17 + '@swc/counter': 0.1.3 + jsonc-parser: 3.2.1 + dev: true + + /@swc/types@0.1.6: + resolution: {integrity: sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg==} + dependencies: + '@swc/counter': 0.1.3 + dev: true + /@tsconfig/node10@1.0.11: resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} dev: true @@ -1988,13 +2135,6 @@ packages: update-browserslist-db: 1.0.13(browserslist@4.23.0) dev: true - /bs-logger@0.2.6: - resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} - engines: {node: '>= 6'} - dependencies: - fast-json-stable-stringify: 2.1.0 - dev: true - /bser@2.1.1: resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} dependencies: @@ -3505,7 +3645,7 @@ packages: pretty-format: 29.7.0 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.9.2(@types/node@20.12.7)(typescript@5.4.5) + ts-node: 10.9.2(@swc/core@1.4.17)(@types/node@20.12.7)(typescript@5.4.5) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -3874,6 +4014,10 @@ packages: hasBin: true dev: true + /jsonc-parser@3.2.1: + resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} + dev: true + /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} dependencies: @@ -3983,10 +4127,6 @@ packages: resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} dev: false - /lodash.memoize@4.1.2: - resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} - dev: true - /lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true @@ -4860,41 +5000,7 @@ packages: typescript: 5.4.5 dev: true - /ts-jest@29.1.2(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.4.5): - resolution: {integrity: sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==} - engines: {node: ^16.10.0 || ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@babel/core': '>=7.0.0-beta.0 <8' - '@jest/types': ^29.0.0 - babel-jest: ^29.0.0 - esbuild: '*' - jest: ^29.0.0 - typescript: '>=4.3 <6' - peerDependenciesMeta: - '@babel/core': - optional: true - '@jest/types': - optional: true - babel-jest: - optional: true - esbuild: - optional: true - dependencies: - '@babel/core': 7.24.4 - bs-logger: 0.2.6 - fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2) - jest-util: 29.7.0 - json5: 2.2.3 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.6.0 - typescript: 5.4.5 - yargs-parser: 21.1.1 - dev: true - - /ts-node@10.9.2(@types/node@20.12.7)(typescript@5.4.5): + /ts-node@10.9.2(@swc/core@1.4.17)(@types/node@20.12.7)(typescript@5.4.5): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -4909,6 +5015,7 @@ packages: optional: true dependencies: '@cspotcode/source-map-support': 0.8.1 + '@swc/core': 1.4.17 '@tsconfig/node10': 1.0.11 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 diff --git a/src/lib/GitHubActionsRunner.ts b/src/lib/GitHubActionsRunner.ts index 66f47a9..02124e2 100644 --- a/src/lib/GitHubActionsRunner.ts +++ b/src/lib/GitHubActionsRunner.ts @@ -184,7 +184,7 @@ export class GitHubActionsRunner { logger.info(logs); if (workflowRun.conclusion !== WORKFLOW_RUN_SUCCESSFUL_CONCLUSION_STATUS) { - throw new Error(`Workflow run failed with conclusion "${workflowRun.conclusion}".`); + throw new Error(`Workflow run failed with conclusion: "${workflowRun.conclusion}".`); } if (artifactsPath) { diff --git a/src/lib/github/GithubApiManager.ts b/src/lib/github/GithubApiManager.ts index b732d45..0b1a292 100644 --- a/src/lib/github/GithubApiManager.ts +++ b/src/lib/github/GithubApiManager.ts @@ -67,10 +67,10 @@ export class GithubApiManager { * Constructor. * Initializes a new instance of the GithubApiManager with the specified GitHub API client. * - * @param apiClient The GitHub API client. + * @param githubApiClient The GitHub API client. */ - constructor(apiClient: GithubApiClient) { - this.githubApiClient = apiClient; + constructor(githubApiClient: GithubApiClient) { + this.githubApiClient = githubApiClient; } /** @@ -443,7 +443,7 @@ export class GithubApiManager { * @returns A promise that resolves when all artifacts are downloaded. * @throws An error if the download fails or no artifacts are found. */ - async downloadArtifacts(workflowRun: WorkflowRun, artifactsPath: string): Promise { + async downloadArtifacts(workflowRun: Pick, artifactsPath: string): Promise { logger.info('Downloading artifacts...'); const artifactsList = await this.listWorkflowArtifacts(workflowRun.id); @@ -453,7 +453,7 @@ export class GithubApiManager { * Consequently, if no artifacts are found, an error should be thrown. */ if (artifactsList.length === 0) { - throw new Error('No artifacts found'); + throw new Error(`No artifacts found for the workflow run with name: "${workflowRun.name}"`); } logger.info(`Artifacts found: ${artifactsList.map((artifact) => artifact.name).join(', ')}`); From dc1fc14c0ee20fd2c3126f554824825f55a2cb95 Mon Sep 17 00:00:00 2001 From: Maxim Topciu Date: Tue, 23 Apr 2024 14:08:42 +0300 Subject: [PATCH 10/10] test if disappear --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3dd8519..5ca0a45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,10 +10,6 @@ on: id: type: 'string' description: 'Unique identifier for the workflow run. Needed for github-actions-runner' - # FIXME remove, needed only for appearing in the Actions tab - push: - branches: - - 'feature/AG-32057' ## Required for github-actions-runner run-name: ${{github.workflow}} [ID:${{ inputs.id }}]