2020-01-04 07:33:25 +03:00
|
|
|
name: Cargo
|
|
|
|
|
2020-02-18 06:27:13 +03:00
|
|
|
on: [push, pull_request]
|
2020-02-18 05:36:56 +03:00
|
|
|
#on:
|
|
|
|
# push:
|
|
|
|
# # Ignore commits created by bors
|
|
|
|
# branches-ignore:
|
|
|
|
# - 'staging'
|
|
|
|
# - 'trying'
|
|
|
|
# pull_request:
|
|
|
|
# branches-ignore:
|
|
|
|
# - 'staging'
|
|
|
|
# - 'trying'
|
2020-01-04 07:33:25 +03:00
|
|
|
|
|
|
|
env:
|
2021-05-27 05:59:04 +03:00
|
|
|
CI: 1
|
2020-01-04 07:33:25 +03:00
|
|
|
CARGO_INCREMENTAL: 0
|
2021-03-22 13:42:42 +03:00
|
|
|
RUST_LOG: "debug"
|
2020-01-04 07:33:25 +03:00
|
|
|
|
|
|
|
jobs:
|
2021-03-26 18:45:51 +03:00
|
|
|
check-license:
|
|
|
|
name: Check license
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
|
|
|
|
- name: Install required tools
|
|
|
|
run: |
|
|
|
|
cargo install cargo-deny
|
|
|
|
|
|
|
|
- name: Check licenses
|
|
|
|
run: |
|
|
|
|
cargo deny check
|
|
|
|
|
2020-01-04 07:33:25 +03:00
|
|
|
fmt:
|
2020-01-17 12:44:51 +03:00
|
|
|
name: fmt
|
2020-01-04 07:33:25 +03:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-06 08:56:54 +03:00
|
|
|
env:
|
|
|
|
RUST_LOG: "0"
|
2020-01-04 07:33:25 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-03-25 19:22:09 +03:00
|
|
|
|
|
|
|
# We explicitly do this to cache properly.
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
components: rustfmt
|
|
|
|
|
2020-01-04 07:33:25 +03:00
|
|
|
- name: Run cargo fmt
|
|
|
|
run: cargo fmt --all -- --check
|
|
|
|
|
2021-03-22 13:42:42 +03:00
|
|
|
check:
|
|
|
|
name: Check
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-10.15
|
2021-05-10 10:18:31 +03:00
|
|
|
- windows-latest
|
2021-01-22 12:39:57 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-03-25 19:22:09 +03:00
|
|
|
|
|
|
|
# We explicitly do this to cache properly.
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
|
2021-03-22 13:42:42 +03:00
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/
|
|
|
|
target
|
2021-04-30 09:25:24 +03:00
|
|
|
Cargo.lock
|
2021-05-27 05:59:04 +03:00
|
|
|
key: ${{ runner.os }}-cargo-v4
|
2021-03-22 13:42:42 +03:00
|
|
|
# Ensure that all components are compilable.
|
2021-01-22 12:39:57 +03:00
|
|
|
- name: Run cargo check for all targets
|
|
|
|
run: cargo check --color always --all --all-targets
|
2020-05-22 14:36:39 +03:00
|
|
|
test:
|
2021-03-22 13:42:42 +03:00
|
|
|
name: Test
|
|
|
|
runs-on: ${{ matrix.os }}
|
2021-01-22 12:39:57 +03:00
|
|
|
strategy:
|
2021-02-19 09:34:22 +03:00
|
|
|
fail-fast: false
|
2021-01-22 12:39:57 +03:00
|
|
|
matrix:
|
2021-03-22 13:42:42 +03:00
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
2021-05-09 05:51:37 +03:00
|
|
|
# - macos-10.15
|
2021-05-10 10:18:31 +03:00
|
|
|
- windows-latest
|
2021-01-22 12:39:57 +03:00
|
|
|
crate:
|
|
|
|
- ast_node
|
|
|
|
- enum_kind
|
|
|
|
- from_variant
|
|
|
|
- jsdoc
|
2021-05-06 08:56:54 +03:00
|
|
|
- node
|
2021-01-22 12:39:57 +03:00
|
|
|
- string_enum
|
|
|
|
- swc
|
|
|
|
- swc_atoms
|
2021-05-06 08:56:54 +03:00
|
|
|
- swc_babel_ast
|
|
|
|
- swc_babel_compat
|
|
|
|
- swc_babel_visit
|
2021-01-22 12:39:57 +03:00
|
|
|
- swc_bundler
|
|
|
|
- swc_common
|
2021-08-19 08:16:32 +03:00
|
|
|
- swc_css
|
|
|
|
- swc_css_ast
|
2021-08-20 15:38:15 +03:00
|
|
|
- swc_css_codegen
|
2021-08-19 08:16:32 +03:00
|
|
|
- swc_css_parser
|
2021-08-23 17:03:08 +03:00
|
|
|
- swc_css_utils
|
|
|
|
- swc_css_visit
|
2021-01-22 12:39:57 +03:00
|
|
|
- swc_ecma_ast
|
|
|
|
- swc_ecma_codegen
|
|
|
|
- swc_ecma_codegen_macros
|
|
|
|
- swc_ecma_dep_graph
|
|
|
|
- swc_ecma_ext_transforms
|
2021-03-22 13:42:42 +03:00
|
|
|
- swc_ecma_loader
|
2021-05-20 07:51:30 +03:00
|
|
|
- swc_ecma_minifier
|
2021-01-22 12:39:57 +03:00
|
|
|
- swc_ecma_parser
|
|
|
|
- swc_ecma_preset_env
|
|
|
|
- swc_ecma_transforms
|
|
|
|
- swc_ecma_transforms_base
|
2021-06-27 18:30:40 +03:00
|
|
|
- swc_ecma_transforms_classes
|
2021-01-22 12:39:57 +03:00
|
|
|
- swc_ecma_transforms_compat
|
|
|
|
- swc_ecma_transforms_macros
|
|
|
|
- swc_ecma_transforms_module
|
|
|
|
- swc_ecma_transforms_optimization
|
|
|
|
- swc_ecma_transforms_proposal
|
|
|
|
- swc_ecma_transforms_react
|
|
|
|
- swc_ecma_transforms_testing
|
|
|
|
- swc_ecma_transforms_typescript
|
|
|
|
- swc_ecma_utils
|
|
|
|
- swc_ecma_visit
|
|
|
|
- swc_ecmascript
|
|
|
|
- swc_eq_ignore_macros
|
|
|
|
- swc_macros_common
|
2021-06-27 18:30:40 +03:00
|
|
|
- swc_node_base
|
2021-08-13 13:03:04 +03:00
|
|
|
- swc_node_bundler
|
2021-08-25 18:07:09 +03:00
|
|
|
- swc_plugin
|
|
|
|
- swc_plugin_runner
|
|
|
|
- swc_plugin_testing
|
2021-08-23 15:42:13 +03:00
|
|
|
- swc_stylis
|
2021-01-22 12:39:57 +03:00
|
|
|
- swc_visit
|
|
|
|
- swc_visit_macros
|
|
|
|
- testing
|
|
|
|
- testing_macros
|
2021-05-06 08:56:54 +03:00
|
|
|
- wasm
|
2021-03-22 13:42:42 +03:00
|
|
|
exclude:
|
2021-05-10 10:18:31 +03:00
|
|
|
- os: windows-latest
|
2021-08-13 13:03:04 +03:00
|
|
|
crate: swc_node_bundler
|
2021-01-22 12:39:57 +03:00
|
|
|
|
2020-01-04 07:33:25 +03:00
|
|
|
steps:
|
2021-03-22 13:42:42 +03:00
|
|
|
- name: Handle line endings
|
|
|
|
shell: bash
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
git config --system core.autocrlf false
|
|
|
|
git config --system core.eol lf
|
|
|
|
|
2020-01-04 07:33:25 +03:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2021-06-23 13:50:27 +03:00
|
|
|
# Source map format
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-07-30 04:11:27 +03:00
|
|
|
node-version: "16"
|
2021-06-23 13:50:27 +03:00
|
|
|
|
2021-03-25 19:22:09 +03:00
|
|
|
# We explicitly do this to cache properly.
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
|
2021-01-11 13:39:17 +03:00
|
|
|
- uses: actions/setup-node@v2
|
2020-08-30 09:29:42 +03:00
|
|
|
with:
|
2021-07-30 04:11:27 +03:00
|
|
|
node-version: 16
|
2020-05-22 14:36:39 +03:00
|
|
|
|
2021-07-13 15:41:40 +03:00
|
|
|
- uses: denoland/setup-deno@v1
|
2021-04-14 17:00:33 +03:00
|
|
|
with:
|
|
|
|
deno-version: v1.x
|
|
|
|
|
2020-01-04 07:33:25 +03:00
|
|
|
- name: Checkout submodules
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
|
|
|
|
git submodule sync --recursive
|
|
|
|
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
|
|
|
|
|
|
|
|
- name: Install node dependencies
|
2021-03-22 13:42:42 +03:00
|
|
|
shell: bash
|
2020-01-04 07:33:25 +03:00
|
|
|
run: |
|
2021-03-22 13:42:42 +03:00
|
|
|
# This does not have any effect on windows.
|
|
|
|
npm config set prefix $HOME/npm
|
2021-08-02 18:49:34 +03:00
|
|
|
yarn
|
2021-08-12 15:28:58 +03:00
|
|
|
(cd ecmascript/transforms && yarn)
|
2020-01-04 07:33:25 +03:00
|
|
|
npm i -g jest
|
2021-03-22 13:42:42 +03:00
|
|
|
echo $HOME
|
|
|
|
echo $HOME/npm/bin >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: Configure path (windows)
|
|
|
|
shell: bash
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
echo 'C:\\npm\\prefix' >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: Verify dependencies
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
jest -v
|
2020-01-04 07:33:25 +03:00
|
|
|
|
2020-08-03 19:33:23 +03:00
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/
|
2021-03-22 13:42:42 +03:00
|
|
|
target
|
2021-04-30 09:25:24 +03:00
|
|
|
Cargo.lock
|
2021-05-27 05:59:04 +03:00
|
|
|
key: ${{ runner.os }}-cargo-v4
|
2020-08-03 19:33:23 +03:00
|
|
|
|
2021-01-05 08:29:52 +03:00
|
|
|
- name: Run cargo test
|
2020-01-04 07:33:25 +03:00
|
|
|
run: |
|
2021-03-22 13:42:42 +03:00
|
|
|
jest -v
|
2021-01-22 12:39:57 +03:00
|
|
|
cargo test --color always -p ${{ matrix.crate }}
|
2021-03-17 09:24:35 +03:00
|
|
|
|
2021-10-08 10:47:01 +03:00
|
|
|
- name: Run cargo test (concurrent)
|
2021-10-19 08:31:12 +03:00
|
|
|
if: runner.os != 'Windows'
|
2021-10-09 11:08:13 +03:00
|
|
|
shell: bash
|
2021-10-08 10:47:01 +03:00
|
|
|
run: |
|
2021-10-09 11:08:13 +03:00
|
|
|
./scripts/ci/test-concurrent.sh ${{ matrix.crate }}
|
2021-10-08 10:47:01 +03:00
|
|
|
|
2021-10-17 18:03:30 +03:00
|
|
|
- name: Run cargo test (swc, concurrent)
|
|
|
|
shell: bash
|
|
|
|
if: matrix.crate == 'swc'
|
|
|
|
run: |
|
|
|
|
./scripts/ci/test-concurrent.sh ${{ matrix.crate }}
|
|
|
|
|
2021-03-31 07:09:10 +03:00
|
|
|
deploy-docs:
|
|
|
|
name: Docs
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# if: github.ref == 'refs/heads/master'
|
|
|
|
# needs:
|
|
|
|
# - test
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
|
|
|
|
- name: Create rustdoc
|
2021-08-23 15:42:13 +03:00
|
|
|
run: cargo doc --all
|
2021-03-31 07:09:10 +03:00
|
|
|
|
|
|
|
- name: Create CNAME
|
|
|
|
run: |
|
|
|
|
echo 'rustdoc.swc.rs' > target/doc/CNAME
|
|
|
|
|
|
|
|
- name: Deploy
|
2021-03-31 13:30:05 +03:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-03-31 07:09:10 +03:00
|
|
|
uses: JamesIves/github-pages-deploy-action@4.1.0
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GH_TOKEN }}
|
|
|
|
branch: gh-pages
|
|
|
|
folder: target/doc
|
|
|
|
clean: true
|
2021-06-24 09:32:09 +03:00
|
|
|
git-config-email: github-bot@swc.rs
|
2021-03-31 07:09:10 +03:00
|
|
|
repository-name: swc-project/rustdoc
|
|
|
|
commit-message: "Update"
|
|
|
|
single-commit: true
|