chore: release 2.6.1 #11
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
name: Build and Test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
install-dependencies: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
- name: Restore workspace cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
node_modules | ||
example/node_modules | ||
key: dependencies-${{ runner.os }}-${{ hashFiles('package.json') }} | ||
restore-keys: | | ||
dependencies-${{ runner.os }}- | ||
- name: Install dependencies (example) | ||
run: yarn install --cwd example --frozen-lockfile | ||
- name: Install dependencies (root) | ||
run: yarn install --frozen-lockfile | ||
- name: Save workspace | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: workspace | ||
path: . | ||
Here’s how you can convert the provided CircleCI configuration to a GitHub Actions workflow while ensuring that the build script uses Node.js 18. | ||
Key Changes: | ||
Node.js Version: Updated to use Node.js 18. | ||
Caching: GitHub Actions uses actions/cache for caching dependencies. | ||
Workspace Management: Instead of attach_workspace, the workspace management is handled natively by GitHub Actions. | ||
GitHub Actions Workflow (.github/workflows/ci.yml) | ||
yaml | ||
Copy code | ||
name: Build and Test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
install-dependencies: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
- name: Restore workspace cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
node_modules | ||
example/node_modules | ||
key: dependencies-${{ runner.os }}-${{ hashFiles('package.json') }} | ||
restore-keys: | | ||
dependencies-${{ runner.os }}- | ||
- name: Install dependencies (example) | ||
run: yarn install --cwd example --frozen-lockfile | ||
- name: Install dependencies (root) | ||
run: yarn install --frozen-lockfile | ||
- name: Save workspace | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: workspace | ||
path: . | ||
lint: | ||
runs-on: ubuntu-latest | ||
needs: install-dependencies | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Download workspace | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: workspace | ||
path: . | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Run lint | ||
run: yarn lint | ||
typescript: | ||
runs-on: ubuntu-latest | ||
needs: install-dependencies | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Download workspace | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: workspace | ||
path: . | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Typecheck files | ||
run: yarn typescript | ||
# unit-tests: | ||
# runs-on: ubuntu-latest | ||
# needs: install-dependencies | ||
# strategy: | ||
# matrix: | ||
# node-version: [18.x] | ||
# steps: | ||
# - name: Download workspace | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: workspace | ||
# path: . | ||
# - name: Set up Node.js | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: ${{ matrix.node-version }} | ||
# - name: Run unit tests | ||
# run: yarn test --coverage | ||
# - name: Upload coverage | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: coverage | ||
# path: coverage | ||
build-package: | ||
runs-on: ubuntu-latest | ||
needs: install-dependencies | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Download workspace | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: workspace | ||
path: . | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Build package | ||
run: yarn prepare |