-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge in CI/github-actions-runner from feature/AG-32057 to master * commit 'dc1fc14c0ee20fd2c3126f554824825f55a2cb95': test if disappear add test fail if workflow run was broken or if no artifacts found use real start time fail test fix eslint error show action set gh token fix path test build on github actions
- Loading branch information
Showing
10 changed files
with
304 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.