2020-01-27 21:07:31 +01:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize]
|
|
|
|
|
|
|
|
name: Generate Pull Request Stats
|
|
|
|
|
2022-05-29 06:35:16 +02:00
|
|
|
env:
|
2022-12-20 08:39:15 +01:00
|
|
|
NAPI_CLI_VERSION: 2.13.3
|
2022-11-14 20:52:12 +01:00
|
|
|
TURBO_VERSION: 1.6.3
|
2022-11-10 11:52:48 +01:00
|
|
|
RUST_TOOLCHAIN: nightly-2022-11-04
|
2022-10-03 17:07:52 +02:00
|
|
|
PNPM_VERSION: 7.3.0
|
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
|
2022-09-06 19:03:21 +02:00
|
|
|
run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
|
2021-10-29 20:56:56 +02:00
|
|
|
id: docs-change
|
|
|
|
|
|
|
|
- name: Cache cargo registry
|
|
|
|
uses: actions/cache@v1
|
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
|
|
|
|
uses: actions/cache@v1
|
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
|
|
|
|
run: echo ::set-output name=WEEK::$(date +%U)
|
|
|
|
|
|
|
|
- name: Turbo Cache
|
|
|
|
id: turbo-cache
|
2022-05-04 20:51:25 +02:00
|
|
|
uses: actions/cache@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:
|
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
|
|
|
|
|
|
|
# We use restore-key to pick latest cache.
|
|
|
|
# We will not get exact match, but doc says
|
|
|
|
# "If there are multiple partial matches for a restore key, the action returns the most recently created cache."
|
|
|
|
# So we get latest cache
|
|
|
|
- name: Cache built files
|
2022-05-04 20:51:25 +02:00
|
|
|
uses: actions/cache@v3
|
2021-10-29 20:56:56 +02:00
|
|
|
with:
|
2021-11-21 12:59:56 +01:00
|
|
|
path: ./packages/next-target
|
2022-08-22 15:30:35 +02:00
|
|
|
key: next-swc-cargo-cache-ubuntu-latest--${{ hashFiles('**/Cargo.lock') }}
|
2021-10-29 20:56:56 +02:00
|
|
|
restore-keys: |
|
2022-08-22 15:30:35 +02:00
|
|
|
next-swc-cargo-cache-ubuntu-latest
|
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
|
2022-09-06 19:03:21 +02:00
|
|
|
run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
|
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' }}
|