Skip to content

add ThemeToggleButton, tests and doc #1926

add ThemeToggleButton, tests and doc

add ThemeToggleButton, tests and doc #1926

Workflow file for this run

name: CI Checks
on:
push:
branches:
- main
pull_request:
jobs:
formatting:
runs-on: ubuntu-20.04
# In order to trigger the CLA after committing formatting changes, we need
# to use the GIX_CREATE_PR_PAT token. This token is not available for all
# users. So on PRs where the token is not available, we don't commit
# changes and instead just fail if the formatting is incorrect.
steps:
- name: Check if commits can be added
id: check_can_add_commit
run: |
echo "can_add_commit=${{ secrets.GIX_CREATE_PR_PAT != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT
- name: Checkout
if: steps.check_can_add_commit.outputs.can_add_commit == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GIX_CREATE_PR_PAT }}
- name: Checkout
if: steps.check_can_add_commit.outputs.can_add_commit == 'false'
uses: actions/checkout@v4
- name: Install shfmt
run: sudo snap install --classic shfmt
- name: Format shell scripts
run: ./scripts/fmt-sh
- name: Install ts dependencies
run: npm ci
- name: Format ts
run: npm run format
- name: Check formatting changes
id: check_format
run: |
if git diff --exit-code; then
echo "formatting_needed=false" >> $GITHUB_OUTPUT
else
echo "formatting_needed=true" >> $GITHUB_OUTPUT
fi
- name: Commit Formatting changes
if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_format.outputs.formatting_needed == 'true'
uses: EndBug/add-and-commit@v9.1.4
with:
add: .
default_author: github_actions
message: "Updating formatting"
# do not pull: if this branch is behind, then we might as well let
# the pushing fail
pull_strategy: "NO-PULL"
- name: Fail for formatting issues without personal access token
if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_format.outputs.formatting_needed == 'true'
run: |
echo "Formatting changes are needed but couldn't be committed because the personal access token isn't available or this isn't a pull request."
exit 1
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
lint:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint -- --max-warnings 0
test:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run test
e2e:
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Print chrome version
run: |
echo "google-chrome --version"
google-chrome --version
- name: Cache and restore samples
uses: actions/cache@v2
id: samples
with:
path: ./samples/
key: ${{ runner.os }}-samples-${{ hashFiles('**/scripts/download-samples.sh') }}
restore-keys: |
${{ runner.os }}-samples-
- name: Install dependencies
run: npm ci
- name: Run Playwright tests
run: npm run e2e:ci
- uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
may-merge:
needs: ["formatting", "build", "lint", "test", "e2e"]
runs-on: ubuntu-20.04
steps:
- name: Cleared for merging
run: echo OK