2020-01-27 21:07:31 +01:00
|
|
|
on:
|
2023-05-28 06:02:31 +02:00
|
|
|
pull_request_target:
|
2020-01-27 21:07:31 +01:00
|
|
|
types: [opened, synchronize]
|
|
|
|
|
|
|
|
name: Generate Pull Request Stats
|
|
|
|
|
2022-05-29 06:35:16 +02:00
|
|
|
env:
|
2023-02-10 20:58:55 +01:00
|
|
|
NAPI_CLI_VERSION: 2.14.7
|
2023-05-28 06:02:31 +02:00
|
|
|
TURBO_VERSION: 1.9.6
|
2023-03-09 22:24:24 +01:00
|
|
|
RUST_TOOLCHAIN: nightly-2023-03-09
|
2023-01-12 02:36:52 +01:00
|
|
|
PNPM_VERSION: 7.24.3
|
2022-05-29 06:35:16 +02:00
|
|
|
|
2019-09-12 20:13:15 +02:00
|
|
|
jobs:
|
2021-10-29 20:56:56 +02:00
|
|
|
build-native-dev:
|
|
|
|
name: Build dev binary for tests
|
2022-08-22 15:30:35 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-10-29 20:56:56 +02:00
|
|
|
steps:
|
|
|
|
# https://github.com/actions/virtual-environments/issues/1187
|
|
|
|
- name: tune linux network
|
|
|
|
run: sudo ethtool -K eth0 tx off rx off
|
|
|
|
|
2022-05-04 20:51:25 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-29 20:56:56 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 25
|
|
|
|
|
2022-07-11 16:42:51 +02:00
|
|
|
- name: Check non-docs only change
|
2023-01-12 00:20:10 +01:00
|
|
|
run: echo "DOCS_CHANGE<<EOF" >> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT
|
2021-10-29 20:56:56 +02:00
|
|
|
id: docs-change
|
|
|
|
|
|
|
|
- name: Cache cargo registry
|
2023-01-23 23:39:11 +01:00
|
|
|
uses: actions/cache@v3
|
2023-02-07 01:35:18 +01:00
|
|
|
timeout-minutes: 5
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|
2021-10-29 20:56:56 +02:00
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
2022-08-22 15:30:35 +02:00
|
|
|
key: stable-ubuntu-latest-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
2021-10-29 20:56:56 +02:00
|
|
|
|
|
|
|
- name: Cache cargo index
|
2023-01-23 23:39:11 +01:00
|
|
|
uses: actions/cache@v3
|
2023-02-07 01:35:18 +01:00
|
|
|
timeout-minutes: 5
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|
2021-10-29 20:56:56 +02:00
|
|
|
with:
|
|
|
|
path: ~/.cargo/git
|
2022-08-22 15:30:35 +02:00
|
|
|
key: stable-ubuntu-latest-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
2021-10-29 20:56:56 +02:00
|
|
|
|
2021-12-16 21:10:45 +01:00
|
|
|
# We use week in the turbo cache key to keep the cache from infinitely growing
|
|
|
|
- id: get-week
|
2023-01-10 23:44:27 +01:00
|
|
|
run: echo "WEEK=$(date +%U)" >> $GITHUB_OUTPUT
|
2021-12-16 21:10:45 +01:00
|
|
|
|
|
|
|
- name: Turbo Cache
|
|
|
|
id: turbo-cache
|
2022-05-04 20:51:25 +02:00
|
|
|
uses: actions/cache@v3
|
2023-02-07 01:35:18 +01:00
|
|
|
timeout-minutes: 5
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|
2021-10-29 20:56:56 +02:00
|
|
|
with:
|
2021-12-16 21:10:45 +01:00
|
|
|
path: .turbo
|
|
|
|
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-
|
|
|
|
turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}-
|
2021-10-29 20:56:56 +02:00
|
|
|
|
2022-12-07 17:43:19 +01:00
|
|
|
- name: Build in docker
|
|
|
|
uses: addnab/docker-run-action@v3
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|
2022-12-07 17:43:19 +01:00
|
|
|
with:
|
|
|
|
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-x64
|
|
|
|
options: -e RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -e NAPI_CLI_VERSION=${{ env.NAPI_CLI_VERSION }} -e TURBO_VERSION=${{ env.TURBO_VERSION }} -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
|
|
|
|
run: |
|
|
|
|
set -e &&
|
|
|
|
rustup toolchain install "${RUST_TOOLCHAIN}" &&
|
|
|
|
rustup default "${RUST_TOOLCHAIN}" &&
|
|
|
|
rustup target add x86_64-unknown-linux-gnu &&
|
|
|
|
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
|
|
|
|
unset CC_x86_64_unknown_linux_gnu && unset CC &&
|
|
|
|
turbo run build-native --cache-dir=".turbo" -- --target x86_64-unknown-linux-gnu &&
|
|
|
|
strip packages/next-swc/native/next-swc.*.node
|
2021-10-29 20:56:56 +02:00
|
|
|
|
|
|
|
- name: Upload artifact
|
2022-05-04 20:51:25 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-10-29 20:56:56 +02:00
|
|
|
with:
|
|
|
|
name: next-swc-dev-binary
|
2021-11-21 12:59:56 +01:00
|
|
|
path: packages/next-swc/native/next-swc.linux-x64-gnu.node
|
2021-10-29 20:56:56 +02:00
|
|
|
|
|
|
|
- name: Clear the cargo caches
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|
2021-10-29 20:56:56 +02:00
|
|
|
run: |
|
|
|
|
cargo install cargo-cache --no-default-features --features ci-autoclean
|
|
|
|
cargo-cache
|
|
|
|
|
2020-01-27 21:07:31 +01:00
|
|
|
stats:
|
2019-09-12 20:13:15 +02:00
|
|
|
name: PR Stats
|
2021-10-29 20:56:56 +02:00
|
|
|
needs: build-native-dev
|
2019-09-12 20:13:15 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-04 20:51:25 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-01-26 21:34:30 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 25
|
|
|
|
|
2022-07-11 16:42:51 +02:00
|
|
|
- name: Check non-docs only change
|
2023-01-12 00:20:10 +01:00
|
|
|
run: echo "DOCS_CHANGE<<EOF" >> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT
|
2021-11-01 17:20:46 +01:00
|
|
|
id: docs-change
|
|
|
|
|
2022-05-04 20:51:25 +02:00
|
|
|
- uses: actions/download-artifact@v3
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|
2021-10-29 20:56:56 +02:00
|
|
|
with:
|
|
|
|
name: next-swc-dev-binary
|
2021-11-21 12:59:56 +01:00
|
|
|
path: packages/next-swc/native
|
2021-10-29 20:56:56 +02:00
|
|
|
|
2021-11-21 12:59:56 +01:00
|
|
|
- run: cp -r packages/next-swc/native .github/actions/next-stats-action/native
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|
2021-10-29 20:56:56 +02:00
|
|
|
|
2020-05-21 14:07:27 +02:00
|
|
|
- uses: ./.github/actions/next-stats-action
|
2022-07-11 16:42:51 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
|