Initial commit
This commit is contained in:
24
.github/workflows/auto-change-prs-branch.yml
vendored
Normal file
24
.github/workflows/auto-change-prs-branch.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Make sure new PRs are sent to development
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ opened ]
|
||||
|
||||
jobs:
|
||||
check-branch:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: Vankka/pr-target-branch-action@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
target: main
|
||||
exclude: dev
|
||||
change-to: dev
|
||||
comment: |
|
||||
Your PR's base branch was set to `main`, PRs should be set to target `dev`.
|
||||
The base branch of this PR has been automatically changed to `dev`, please check that there are no merge conflicts.
|
||||
already-exists-action: close_this
|
||||
already-exists-comment: "Closing, because {url} basing on the same branch"
|
||||
19
.github/workflows/build-zip.yml
vendored
Normal file
19
.github/workflows/build-zip.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Build And Upload Extension Zip Via Artifact
|
||||
|
||||
on: [ pull_request_target ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile --prefer-offline
|
||||
- run: pnpm build
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: dist/*
|
||||
42
.github/workflows/cancel-other-workflows-on-close.yml
vendored
Normal file
42
.github/workflows/cancel-other-workflows-on-close.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Cancel PR workflows on close
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ closed ]
|
||||
|
||||
jobs:
|
||||
cancel:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
if: ${{ github.event.pull_request.merged == false }}
|
||||
steps:
|
||||
- name: Cancel all queued/in_progress workflows for this PR
|
||||
env:
|
||||
BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||
run: |
|
||||
owner="${GITHUB_REPOSITORY%%/*}"
|
||||
repo="${GITHUB_REPOSITORY##*/}"
|
||||
branch="$BRANCH"
|
||||
token="${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
runs=$(curl -s -H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/$owner/$repo/actions/runs?branch=$branch&status=queued" | jq -r '.workflow_runs[].id')
|
||||
|
||||
runs+=" "
|
||||
runs+=$(curl -s -H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/$owner/$repo/actions/runs?branch=$branch&status=in_progress" | jq -r '.workflow_runs[].id')
|
||||
|
||||
for run_id in $runs; do
|
||||
if [ -n "$run_id" ]; then
|
||||
echo "Cancelling workflow run: $run_id"
|
||||
curl -s -X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/$owner/$repo/actions/runs/$run_id/cancel"
|
||||
fi
|
||||
done
|
||||
40
.github/workflows/codeql.yml
vendored
Normal file
40
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: "CodeQL Advanced"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "main", "dev" ]
|
||||
schedule:
|
||||
- cron: '40 18 * * 0'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
permissions:
|
||||
security-events: write
|
||||
packages: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: actions
|
||||
build-mode: none
|
||||
- language: javascript-typescript
|
||||
build-mode: none
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
30
.github/workflows/dependencies-auto-merge.yml
vendored
Normal file
30
.github/workflows/dependencies-auto-merge.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Dependabot Pull Request Approve and Merge
|
||||
on: pull_request_target
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
dependabot:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||
steps:
|
||||
- name: Dependabot metadata
|
||||
id: dependabot-metadata
|
||||
uses: dependabot/fetch-metadata@v2
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: Approve a PR
|
||||
run: gh pr review --approve "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Enable auto-merge for Dependabot PRs
|
||||
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
||||
run: gh pr merge --auto --squash "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
71
.github/workflows/e2e-modular.yml
vendored
Normal file
71
.github/workflows/e2e-modular.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Modular E2E Tests Matrix
|
||||
|
||||
on: [ pull_request_target ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
ALL_SCENARIOS: '["content", "content-ui", "content-runtime", "background", "new-tab", "popup", "devtools", "side-panel", "options"]'
|
||||
|
||||
jobs:
|
||||
e2e-tests:
|
||||
name: '${{ matrix.browser }} | Scenario: ${{ matrix.scenario }}'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
browser: ['chrome', 'firefox']
|
||||
scenario: ['content', 'content-ui', 'content-runtime', 'background', 'new-tab', 'popup', 'devtools', 'side-panel', 'options']
|
||||
|
||||
env:
|
||||
CEB_CI: true
|
||||
CURRENT_SCENARIO: ${{ matrix.scenario }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: pnpm
|
||||
|
||||
- run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Configure modules | scenario "${{ matrix.scenario }}"
|
||||
run: |
|
||||
echo "Deleting all features except '${{ matrix.scenario }}'"
|
||||
pnpm module-manager --de ${{ matrix.scenario }} tests
|
||||
|
||||
- name: Run E2E tests (${{ matrix.browser }})
|
||||
run: pnpm e2e${{ matrix.browser == 'firefox' && ':firefox' || '' }}
|
||||
|
||||
- name: Restore one random feature and re-run E2E tests
|
||||
run: |
|
||||
echo "ALL_SCENARIOS=$ALL_SCENARIOS"
|
||||
echo "CURRENT_SCENARIO=$CURRENT_SCENARIO"
|
||||
|
||||
scenarios=($(echo "$ALL_SCENARIOS" | jq -r '.[]'))
|
||||
|
||||
# Filter out current scenario
|
||||
filtered_scenarios=()
|
||||
for scenario in "${scenarios[@]}"; do
|
||||
if [ "$scenario" != "$CURRENT_SCENARIO" ]; then
|
||||
filtered_scenarios+=("$scenario")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#filtered_scenarios[@]} -eq 0 ]; then
|
||||
echo "::warning::No other scenario available, skipping restoration."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
random_feature="${filtered_scenarios[$RANDOM % ${#filtered_scenarios[@]}]}"
|
||||
|
||||
echo "Restoring feature: $random_feature"
|
||||
pnpm module-manager -r "$random_feature"
|
||||
|
||||
- name: Run again E2E tests (${{ matrix.browser }})
|
||||
run: pnpm ${{ matrix.browser == 'chrome' && 'e2e' || 'e2e:firefox' }}
|
||||
|
||||
25
.github/workflows/e2e.yml
vendored
Normal file
25
.github/workflows/e2e.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Run E2E Tests
|
||||
|
||||
on: [ pull_request_target ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
name: E2E tests on ${{ matrix.browser }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
browser: [chrome, firefox]
|
||||
env:
|
||||
CEB_CI: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile --prefer-offline
|
||||
- run: pnpm ${{ matrix.browser == 'chrome' && 'e2e' || 'e2e:firefox' }}
|
||||
16
.github/workflows/greetings.yml
vendored
Normal file
16
.github/workflows/greetings.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
name: Greetings
|
||||
|
||||
on: [ pull_request_target, issues ]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: 'Thank you for your contribution. We will check and reply to you as soon as possible.'
|
||||
pr-message: 'Thank you for your contribution. We will check and reply to you as soon as possible.'
|
||||
17
.github/workflows/lint.yml
vendored
Normal file
17
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Lint Check
|
||||
|
||||
on: [ pull_request_target ]
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: pnpm
|
||||
|
||||
- run: pnpm install --frozen-lockfile --prefer-offline
|
||||
- run: pnpm lint
|
||||
25
.github/workflows/prettier.yml
vendored
Normal file
25
.github/workflows/prettier.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Formating validation
|
||||
|
||||
on: [ pull_request_target ]
|
||||
|
||||
jobs:
|
||||
prettier:
|
||||
name: Prettier Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Prettier
|
||||
id: prettier-run
|
||||
uses: rutajdash/prettier-cli-action@v1.0.2
|
||||
with:
|
||||
config_path: ./.prettierrc
|
||||
file_pattern: "*.{js,jsx,ts,tsx,json}"
|
||||
|
||||
- name: Prettier Output
|
||||
if: ${{ failure() }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "The following files aren't formatted properly:"
|
||||
echo "${{steps.prettier-run.outputs.prettier_output}}"
|
||||
Reference in New Issue
Block a user