Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk committed Jan 2, 2024
2 parents d2903fe + b65f101 commit c9ac2ee
Show file tree
Hide file tree
Showing 1,476 changed files with 29,935 additions and 11,527 deletions.
4 changes: 3 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ rustflags = [

# restriction
"-Wclippy::dbg_macro",
"-Wclippy::unwrap_in_result",
# Disable this as semantics of `expect` and `Result` are different.
# See: `https://github.com/web-infra-dev/rspack/pull/4848`
# "-Wclippy::unwrap_in_result",
"-Wclippy::unwrap_used",
"-Wclippy::empty_drop",
"-Wclippy::exit",
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
crates/rspack/tests
crates/rspack_error/tests
crates/rspack_plugin_css/webpack_css_cases_to_be_migrated
crates/rspack_plugin_mf
packages/playground/fixtures
packages/rspack/src/stats/DefaultStatsPrinterPlugin.ts
packages/rspack/tests
packages/rspack-test-tools/template
webpack-examples
webpack-test
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ pnpm-lock.yaml
/packages/postcss-loader @web-infra-dev/rspack-ux
/packages/rspack @web-infra-dev/rspack-dx
/packages/rspack-cli @web-infra-dev/rspack-dx
/packages/rspack-dev-client @web-infra-dev/rspack-dx
/packages/rspack-dev-middleware @web-infra-dev/rspack-dx
/packages/rspack-dev-server @web-infra-dev/rspack-dx
/packages/rspack-plugin-html @web-infra-dev/rspack-dx
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/download-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ runs:
shell: bash
run: |
set -e
save_dir=$HOME/.cache/runner/${{ github.repository_id }}-${{ github.run_id }}-${{ inputs.name }}
save_dir=$HOME/.cache/runner/${{ github.repository_id }}-${{ github.sha }}-${{ inputs.name }}
# download file
if [ "${{ inputs.link-when-local }}" = "true" ]; then
ln -s $save_dir/* ${{ inputs.path }}
echo "ln -s $save_dir/* ${{ inputs.path }}"
ln -sf $save_dir/* ${{ inputs.path }}
echo "ln -sf $save_dir/* ${{ inputs.path }}"
else
cp -r $save_dir/* ${{ inputs.path }}
echo "cp -r $save_dir/* ${{ inputs.path }}"
cp -rf $save_dir/* ${{ inputs.path }}
echo "cp -rf $save_dir/* ${{ inputs.path }}"
fi
10 changes: 5 additions & 5 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ runs:
find $cache_dir -type d -maxdepth 1 -mindepth 1 -cmin +180 | xargs rm -rf
# save file
save_dir="$cache_dir/${{ github.repository_id }}-${{ github.run_id }}-${{ inputs.name }}"
save_dir="$cache_dir/${{ github.repository_id }}-${{ github.sha }}-${{ inputs.name }}"
rm -rf $save_dir
mkdir $save_dir
if [ "${{ inputs.mv-when-local }}" = "true" ]; then
mv ${{ inputs.path }} $save_dir
echo "mv ${{ inputs.path }} $save_dir"
mv -f ${{ inputs.path }} $save_dir
echo "mv -f ${{ inputs.path }} $save_dir"
else
cp -r ${{ inputs.path }} $save_dir
echo "cp -r ${{ inputs.path }} $save_dir"
cp -rf ${{ inputs.path }} $save_dir
echo "cp -rf ${{ inputs.path }} $save_dir"
fi
# TODO echo machine name as runner labels
Expand Down
1 change: 1 addition & 0 deletions .github/teams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ team:
- "@jkzing"
- "@zhoushaw"
- "@ulivz"
- "@LingyuCoder"
90 changes: 0 additions & 90 deletions .github/workflows/bench-rust.yaml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,37 @@ jobs:
- name: Run test
run: cargo test --workspace -- --nocapture

run_benchmark:
runs-on: ubuntu-latest
if: github.ref_name == 'main'
steps:
- name: Run Benchmark
uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: ${{ github.repository_owner }}
repo: 'rspack-ecosystem-benchmark'
workflow_file_name: 'bench_rspack_commit.yml'
github_token: ${{ secrets.RSPACK_BOT_ACCESS_TOKEN }}
ref: 'main'
client_payload: '{"commit_sha":"${{ github.sha }}"}'


failure_notification:
name: Failure Notification
needs: [test-linux, test-windows, test-mac, rust_check, rust_test, run_benchmark]
if: ${{ failure() && !cancelled() && github.ref_name == 'main' && github.repository_owner == 'web-infra-dev' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- shell: bash
run: ./scripts/alert/lark.js
env:
TITLE: CI failed on main branch
DESCRIPTION: |
commitID: [${{github.sha}}](${{github.server_url}}/${{github.repository}}/commit/${{github.sha}})
URL: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
LARK_WEBHOOK_URL: ${{secrets.LARK_WEBHOOK_URL}}
87 changes: 70 additions & 17 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
name: Diff Assets

on:
pull_request_review_comment:
types: [created]
issue_comment:
types: [created]

Expand All @@ -14,54 +16,105 @@ jobs:
build:
name: Build
needs: [get-runner-labels]
if: github.event.issue.pull_request && contains(github.event.comment.body, '!diff')
if: (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') && contains(github.event.comment.body, '!diff')
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
array:
- target: x86_64-unknown-linux-gnu # For Cloud IDE
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
uses: ./.github/workflows/reusable-build.yml
with:
ref: refs/pull/${{ github.event.issue.number }}/head
profile: "debug"
ref: refs/pull/${{ github.event.issue.number || github.event.pull_request.number }}/head
target: ${{ matrix.array.target }}
runner: ${{ matrix.array.runner }}
test: false

diff:
name: Diff Assets
runs-on: ubuntu-latest
needs: build
needs: [build, get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
steps:
- name: Checkout Branch
uses: actions/checkout@v3
with:
fetch-depth: 1
ref: refs/pull/${{ github.event.issue.number }}/head
ref: refs/pull/${{ github.event.issue.number || github.event.pull_request.number }}/head

- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache

- name: Download artifacts
uses: actions/download-artifact@v3
- name: Download bindings
uses: ./.github/actions/download-artifact
with:
path: artifacts
name: bindings-x86_64-unknown-linux-gnu
path: crates/node_binding/
try-local-cache: true
link-when-local: true

- name: Build node packages
run: pnpm run build:js

- name: Move artifacts
run: node scripts/build-npm.cjs

- name: Build Viewer
run: pnpm run build:viewer

- name: Run Diff
run: node scripts/diff.cjs

- name: Upload Report
shell: bash
env:
API_TOKEN_GITHUB: ${{ secrets.RSPACK_REPORT_ACCESS_TOKEN }}
run: |
cache_dir="$HOME/.cache/diff_upload"
clone_dir="$cache_dir/${{ github.run_id }}"
# Cleaning history upload cache
if [ -d $cache_dir ]
then
find $cache_dir -type d -maxdepth 1 -mindepth 1 -cmin +180 | xargs rm -rf
fi
# Cloning into dest directory
mkdir -p $clone_dir
git config --global user.email "lingyucoder@gmail.com"
git config --global user.name "LingyuCoder"
git clone --single-branch --branch main "https://x-access-token:$API_TOKEN_GITHUB@github.com/web-infra-dev/rspack-report-website.git" $clone_dir
# Copying content into dest repo
dest_dir="$clone_dir/diff/${{ github.run_id }}"
cp -R diff_output/. $dest_dir
# Committing and pushing
cd $clone_dir
current_time=$(date +%s)
gap=$((30 * 24 * 60 * 60))
for cur_dir in ./diff/* ; do
create_time=$(git log --follow --format="%at" --date default $cur_dir | tail -1)
diff=$(($current_time - $create_time))
if [ $diff -gt $gap ]; then
echo "Remove $cur_dir because it is older than a month"
rm -rf $cur_dir
fi
done
commit_message="Update from https://github.com/web-infra-dev/rspack/commit/${{ github.sha }}"
git add .
if LC_ALL=C git status | grep -q "Changes to be committed"
then
git commit --message "$commit_message"
git push -u origin HEAD:main
else
echo "No changes detected"
fi
# Cleaning upload cache
if [ -d $clone_dir ]
then
rm -rf $clone_dir
fi
- name: Write a new comment
uses: peter-evans/create-or-update-comment@v3
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number }}
body-path: 'diff_output'
issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}
body-path: 'diff_output/stats.md'
Loading

0 comments on commit c9ac2ee

Please sign in to comment.