Skip to content

Commit

Permalink
fix: ts config
Browse files Browse the repository at this point in the history
  • Loading branch information
socialcode-rob1 committed Sep 30, 2024
1 parent c5aff08 commit 78504ca
Showing 1 changed file with 153 additions and 49 deletions.
202 changes: 153 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,89 +11,193 @@ on:
jobs:
install-dependencies:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Restore dependencies cache
uses: actions/cache@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
path: node_modules
key: dependencies-${{ hashFiles('package.json') }}
restore-keys: |
dependencies-
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Restore example dependencies cache
- name: Restore workspace cache
uses: actions/cache@v3
with:
path: example/node_modules
key: dependencies-example-${{ hashFiles('example/package.json') }}
path: |
node_modules
example/node_modules
key: dependencies-${{ runner.os }}-${{ hashFiles('package.json') }}
restore-keys: |
dependencies-example-
dependencies-${{ runner.os }}-
- name: Install dependencies
run: |
yarn install --cwd example --frozen-lockfile
yarn install --frozen-lockfile
- name: Install dependencies (example)
run: yarn install --cwd example --frozen-lockfile

- name: Save dependencies cache
uses: actions/cache@v3
- name: Install dependencies (root)
run: yarn install --frozen-lockfile

- name: Save workspace
uses: actions/upload-artifact@v3
with:
path: node_modules
key: dependencies-${{ hashFiles('package.json') }}
name: workspace
path: .


- name: Save example dependencies cache
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: example/node_modules
key: dependencies-example-${{ hashFiles('example/package.json') }}
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: Checkout code
uses: actions/checkout@v3

- name: Lint files
run: |
yarn lint
- 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: Checkout code
uses: actions/checkout@v3
- 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
run: yarn typescript

unit-tests:
runs-on: ubuntu-latest
needs: install-dependencies
steps:
- name: Checkout code
uses: actions/checkout@v3
# unit-tests:
# runs-on: ubuntu-latest
# needs: install-dependencies
# strategy:
# matrix:
# node-version: [18.x]

- name: Run unit tests
run: |
yarn test --coverage
# steps:
# - name: Download workspace
# uses: actions/download-artifact@v3
# with:
# name: workspace
# path: .

- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage
# - 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: Checkout code
uses: actions/checkout@v3
- 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
run: yarn prepare

0 comments on commit 78504ca

Please sign in to comment.