Skip to content

feat: add useLightningcss option (default: true) to enable Lightning CSS #19

feat: add useLightningcss option (default: true) to enable Lightning CSS

feat: add useLightningcss option (default: true) to enable Lightning CSS #19

Workflow file for this run

name: Pull Request Validation
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- converted_to_draft
- edited
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
push:
branches:
- develop
env:
APP_NAME: 'rs-compiler'
CI: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.ref }}
cancel-in-progress: true
# Add restricted permissions to GITHUB_TOKEN
permissions:
contents: write
pull-requests: write
repository-projects: write
jobs:
pr-validation:
name: PR Validation
if: github.event.pull_request.number == null || !github.event.pull_request.draft
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
settings:
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/github-script@v7
if: github.event.pull_request.number != null
id: pr
with:
script: |
const { data: pullRequest } = await github.rest.pulls.get({
...context.repo,
pull_number: context.payload.pull_request.number,
});
return pullRequest
- name: Checkout PR code
if: github.event.pull_request.number != null
uses: actions/checkout@v4
with:
ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}}
fetch-depth: 0
fetch-tags: false
- name: Checkout branch code
if: github.event.pull_request.number == null
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
- name: Cache turbo build setup
uses: ./.github/actions/turbo
- name: Validate commit messages
if: github.event.pull_request.number != null
run: pnpm exec commitlint --from=$(git merge-base origin/develop HEAD)
- name: Version mismatch check
run: ./scripts/git/version-mismatch-check.sh
- name: Format code
run: pnpm run format:check
- name: Lint code
run: pnpm run lint:check
- name: Typecheck code
run: pnpm run typecheck
- name: Run tests
run: pnpm run test
- name: Build all public packages
run: pnpm run build --filter "{./packages/*}..." --filter "{./crates/*}..." --continue
- name: Install Playwright browsers
run: pnpm playwright install --with-deps chromium webkit --only-shell
- name: Run visual comparison tests
id: visual-tests
run:
pnpm run test:visual --filter="./apps/*" --filter="!@toss/stylexswc-rollup-large-example"
--filter="!@toss/stylexswc-webpack-example" --continue
- name: Check artifacts
run: pnpm run --filter "{./packages/*}" --filter "{./crates/*}" check:artifacts
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: >-
${{ matrix.settings.target }}-benchmark-${{
github.event.pull_request.number != null
&& format('pr-{0}', github.event.pull_request.number)
|| github.event.ref
}}
restore-keys: |
${{ matrix.settings.target }}-benchmark-22.13.0-
${{ matrix.settings.target }}-benchmark-22.13.0
${{ matrix.settings.target }}-benchmark-pr-
${{ matrix.settings.target }}-benchmark-pr
${{ matrix.settings.target }}-benchmark-
${{ matrix.settings.target }}-benchmark
- name: Run benchmarks
run: pnpm run --filter @toss/stylexswc-rs-compiler bench
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
with:
tool: 'benchmarkjs'
output-file-path: 'crates/stylex-rs-compiler/benchmark/results/output.txt'
external-data-json-path: './cache/benchmark-data.json'
fail-on-alert: true
comment-on-alert: true
alert-comment-cc-users: '@Dwlad90'
summary-always: true
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '150%'
fail-threshold: '175%'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dependabot:
runs-on: ubuntu-latest
needs: [pr-validation]
if:
github.event.pull_request.number != null && github.event.pull_request.user.login ==
'dependabot[bot]'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # v2.4.0
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Set PR information as environment variables
env:
PR_NUMBER_VALUE: ${{ github.event.pull_request.number }}
PR_URL_VALUE: ${{ github.event.pull_request.html_url }}
PR_HEAD_REF_VALUE: ${{ github.event.pull_request.head.ref }}
UPDATE_TYPE_VALUE: ${{ steps.metadata.outputs.update-type }}
DEPENDENCY_TYPE_VALUE: ${{ steps.metadata.outputs.dependency-type }}
run: |
echo "PR_NUMBER=${PR_NUMBER_VALUE}" >> $GITHUB_ENV
echo "PR_URL=${PR_URL_VALUE}" >> $GITHUB_ENV
echo "PR_HEAD_REF=${PR_HEAD_REF_VALUE}" >> $GITHUB_ENV
echo "UPDATE_TYPE=${UPDATE_TYPE_VALUE}" >> $GITHUB_ENV
echo "DEPENDENCY_TYPE=${DEPENDENCY_TYPE_VALUE}" >> $GITHUB_ENV
- name: Add labels based on dependency type
run: |
if [[ "$DEPENDENCY_TYPE" == "direct:production" ]]; then
gh pr edit "$PR_NUMBER" --add-label "production"
else
gh pr edit "$PR_NUMBER" --add-label "development"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Approve Pull Request
run: |
gh pr review "$PR_NUMBER" --approve -R ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto-merge for safe updates
if: |
(steps.metadata.outputs.update-type == 'version-update:semver-patch' ||
steps.metadata.outputs.update-type == 'version-update:semver-minor')
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
echo "Auto-merging PR..."
git checkout develop
git pull origin develop
git fetch origin "$PR_HEAD_REF"
git merge origin/"$PR_HEAD_REF"
git push origin develop
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on PR if auto-merge is skipped
if: |
(steps.metadata.outputs.update-type != 'version-update:semver-patch' &&
steps.metadata.outputs.update-type != 'version-update:semver-minor')
run: |
REASON="The update type ($UPDATE_TYPE) requires manual review"
gh pr comment "$PR_NUMBER" -b "⚠️ This PR wasn't automatically merged: $REASON"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}