-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: use github actions instead of travis-ci (#344)
- Loading branch information
Showing
2 changed files
with
110 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: Build pull request | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
lint-pull-request: | ||
name: Lint pull request | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
node: [18.x] | ||
steps: | ||
- name: Setup node v${{ matrix.node }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ runner.os }}-node_modules-${{ matrix.node }}-${{ hashFiles('package.json') }} | ||
path: | | ||
node_modules | ||
- name: Check if source or test files changed | ||
id: files_changed | ||
uses: tj-actions/changed-files@v9.1 | ||
with: | ||
files: | | ||
src/**/* | ||
spec/**/* | ||
- name: Install dependencies | ||
if: ${{ steps.files_changed.outputs.any_changed == 'true' || steps.files_changed.outputs.any_deleted == 'true' }} | ||
run: | | ||
yarn | ||
- name: Lint files | ||
if: ${{ steps.files_changed.outputs.any_changed == 'true' || steps.files_changed.outputs.any_deleted == 'true' }} | ||
run: | | ||
yarn lint | ||
build-and-test-pull-request: | ||
needs: | ||
- lint-pull-request | ||
name: Build and test pull request | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
node: [14.x, 16.x, 18.x] | ||
module: [cjs, esm, umd] | ||
target: [es5, es2015, esnext] | ||
steps: | ||
- name: Setup node v${{ matrix.node }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cache targets | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ runner.os }}-targets-${{ matrix.node }}-${{ matrix.target }}-${{ matrix.module }}-${{ hashFiles('package.json') }} | ||
path: | | ||
targets | ||
- name: Cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ runner.os }}-node_modules-${{ matrix.node }}-${{ matrix.target }}-${{ matrix.module }}-${{ hashFiles('package.json') }} | ||
path: | | ||
node_modules | ||
- name: Check if test files changed | ||
id: test_files_changed | ||
uses: tj-actions/changed-files@v9.1 | ||
with: | ||
files: | | ||
spec/**/* | ||
- name: Check if source files changed | ||
id: source_files_changed | ||
uses: tj-actions/changed-files@v9.1 | ||
with: | ||
files: | | ||
src/**/* | ||
- name: Install dependencies | ||
if: ${{ steps.test_files_changed.outputs.any_changed == 'true' || steps.test_files_changed.outputs.any_deleted == 'true' || steps.source_files_changed.outputs.any_changed == 'true' || steps.source_files_changed.outputs.any_deleted == 'true' }} | ||
run: | | ||
yarn | ||
- name: Build package | ||
if: ${{ steps.source_files_changed.outputs.any_changed == 'true' || steps.source_files_changed.outputs.any_deleted == 'true' }} | ||
run: | | ||
yarn build -t ${{ matrix.target }} -m ${{ matrix.module }} | ||
- name: Test package | ||
if: ${{ steps.test_files_changed.outputs.any_changed == 'true' || steps.test_files_changed.outputs.any_deleted == 'true' || steps.source_files_changed.outputs.any_changed == 'true' || steps.source_files_changed.outputs.any_deleted == 'true' }} | ||
run: | | ||
yarn test -t ${{ matrix.target }} -m ${{ matrix.module }} |
This file was deleted.
Oops, something went wrong.