-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
87 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,112 @@ | ||
name: Workflow | ||
on: push | ||
|
||
concurrency: | ||
group: | ||
"${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || | ||
github.ref }}" | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: sh | ||
|
||
jobs: | ||
prepare-environment: | ||
runs-on: ubuntu-latest | ||
name: Prepare environment | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
env: | ||
FORCE_COLOR: 0 | ||
- name: Install node_modules on cache miss | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: yarn install --frozen-lockfile | ||
- name: Cache node_modules | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: node_modules | ||
key: yarn-${{ hashFiles('yarn.lock') }} | ||
|
||
tests: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
needs: prepare-environment | ||
# Tests timeout after 40 minutes | ||
timeout-minutes: 40 | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore node_modules | ||
uses: actions/cache/restore@v3 | ||
id: cache-node-modules | ||
with: | ||
path: node_modules | ||
key: yarn-${{ hashFiles('yarn.lock') }} | ||
fail-on-cache-miss: false | ||
- name: Install node_modules on cache miss | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: yarn install --frozen-lockfile | ||
- name: Build | ||
run: yarn build | ||
- name: Lint | ||
run: yarn lint | ||
- name: Clear Jest | ||
run: yarn jest --clearCache | ||
- name: Test | ||
run: yarn test --coverage | ||
# - name: Send Report | ||
# uses: paambaati/[email protected] | ||
# env: | ||
# CC_TEST_REPORTER_ID: c206a2ed5aa86c7480a13634e91e440a27a98a5d134653f8ea9a7d5f987e68c3 | ||
# with: | ||
# coverageLocations: | | ||
# ${{github.workspace}}/packages/core/coverage/lcov.info:lcov | ||
# ${{github.workspace}}/packages/react/coverage/lcov.info:lcov | ||
|
||
release: | ||
name: Release | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
runs-on: ubuntu-latest | ||
needs: tests | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore node_modules | ||
uses: actions/cache/restore@v3 | ||
id: cache-node-modules | ||
with: | ||
path: node_modules | ||
key: yarn-${{ hashFiles('yarn.lock') }} | ||
fail-on-cache-miss: false | ||
- name: Install node_modules on cache miss | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: yarn install --frozen-lockfile | ||
- name: Build | ||
run: yarn build | ||
- name: Publish | ||
run: yarn release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |