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:
|
|
|
|
NAPI_CLI_VERSION: 2.7.0
|
2022-06-24 16:31:26 +02:00
|
|
|
TURBO_VERSION: 1.3.1
|
2022-05-29 06:35:16 +02:00
|
|
|
RUST_TOOLCHAIN: nightly-2022-02-23
|
2022-06-17 19:36:37 +02:00
|
|
|
PNPM_VERSION: 7.2.1
|
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
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
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
|
|
|
|
|
|
|
|
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
|
|
|
|
id: docs-change
|
|
|
|
|
|
|
|
- name: Setup node
|
2022-05-04 20:51:25 +02:00
|
|
|
uses: actions/setup-node@v3
|
2021-10-29 20:56:56 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
|
|
|
with:
|
2022-05-04 20:51:25 +02:00
|
|
|
node-version: 16
|
2021-10-29 20:56:56 +02:00
|
|
|
check-latest: true
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2021-11-25 00:33:34 +01:00
|
|
|
toolchain: nightly-2021-11-15
|
2021-10-29 20:56:56 +02:00
|
|
|
|
|
|
|
- name: Cache cargo registry
|
|
|
|
uses: actions/cache@v1
|
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
|
|
|
key: stable-ubuntu-18.04-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
- name: Cache cargo index
|
|
|
|
uses: actions/cache@v1
|
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/git
|
|
|
|
key: stable-ubuntu-18.04-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
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
|
2021-10-29 20:56:56 +02:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
|
|
|
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
|
2021-10-29 20:56:56 +02:00
|
|
|
key: next-swc-cargo-cache-ubuntu-18.04--${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
next-swc-cargo-cache-ubuntu-18.04
|
|
|
|
|
2021-11-03 22:58:22 +01:00
|
|
|
# since the repo's dependencies aren't installed we need
|
|
|
|
# to install napi globally
|
2022-05-04 20:51:25 +02:00
|
|
|
- run: npm i -g @napi-rs/cli@2.7.0
|
2022-05-29 06:35:16 +02:00
|
|
|
- run: npm i -g turbo@${TURBO_VERSION} pnpm@${PNPM_VERSION}
|
2021-11-03 22:58:22 +01:00
|
|
|
|
2021-10-29 20:56:56 +02:00
|
|
|
- name: Build
|
2021-12-16 21:10:45 +01:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
|
|
|
run: turbo run build-native --cache-dir=".turbo"
|
2021-10-29 20:56:56 +02:00
|
|
|
env:
|
|
|
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
2021-12-16 21:10:45 +01:00
|
|
|
TURBO_TOKEN: ${{secrets.TURBO_TOKEN}}
|
|
|
|
TURBO_TEAM: nextjs
|
|
|
|
TURBO_PROJECT: nextjs
|
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
|
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
|
|
|
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
|
|
|
|
|
2021-11-01 17:20:46 +01:00
|
|
|
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
|
|
|
|
id: docs-change
|
|
|
|
|
2022-05-04 20:51:25 +02:00
|
|
|
- uses: actions/download-artifact@v3
|
2021-11-01 17:20:46 +01:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
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
|
2021-11-01 17:20:46 +01:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|
2021-10-29 20:56:56 +02:00
|
|
|
|
2020-05-21 14:07:27 +02:00
|
|
|
- uses: ./.github/actions/next-stats-action
|
2021-01-25 22:11:27 +01:00
|
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
|