diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d4dfb74..0099533f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,10 +2,10 @@ name: Build on: pull_request: - branches: * + branches: "*" push: - branches: * + branches: "*" jobs: build: @@ -13,17 +13,12 @@ jobs: strategy: matrix: - node-version: [current, latest] + node-version: [lts/gallium, latest] steps: - name: Checkout Repository uses: actions/checkout@v3 - - name: Set up Node ${{ matrix.node-version }} - uses: actions/setup-node@v3.6.0 - with: - node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v2.2.4 name: Install pnpm id: pnpm-install @@ -31,19 +26,11 @@ jobs: version: latest run_install: false - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache + - name: Set up Node ${{ matrix.node-version }} + uses: actions/setup-node@v3.6.0 with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + node-version: ${{ matrix.node-version }} + cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 4f7f920b..5af19dcd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -5,46 +5,33 @@ on: branches: [master] jobs: - build: + coverage: runs-on: ubuntu-latest steps: - - name: Checkout Repository + - name: Checkout repository uses: actions/checkout@v3 - - name: Set up Node - uses: actions/setup-node@v3.6.0 - with: - node-version: current - - - uses: pnpm/action-setup@v2.2.4 - name: Install pnpm + - name: Install pnpm + uses: pnpm/action-setup@v2.2.4 id: pnpm-install with: version: latest run_install: false - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache + - name: Setup Node.js lts/gallium + uses: actions/setup-node@v3.6.0 with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + node-version: lts/gallium + cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Coverage + - name: Generate coverage report run: pnpm test:coverage - - name: Upload coverage to Codecov + - name: Upload coverage report to Codecov run: bash <(curl -s https://codecov.io/bash) env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml deleted file mode 100644 index 05e9ac1c..00000000 --- a/.github/workflows/dev.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Dev - -on: - push: - branches: - - "*" - - "!master" - - "!stable" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Set up Node - uses: actions/setup-node@v3.6.0 - with: - node-version: current - - - uses: pnpm/action-setup@v2.2.4 - name: Install pnpm - id: pnpm-install - with: - version: latest - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Lint - run: pnpm lint - - - name: Build - run: pnpm build - - - name: Test - run: pnpm test:ci diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..d10e71b0 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,40 @@ +name: Lint + +on: + pull_request: + branches: "*" + + push: + branches: "*" + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - uses: pnpm/action-setup@v2.2.4 + name: Install pnpm + id: pnpm-install + with: + version: latest + run_install: false + + - name: Setup Node lts/gallium + uses: actions/setup-node@v3.6.0 + with: + node-version: lts/gallium + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Audit installed dependencies + run: pnpm audit + + - name: Lint (ESLint) + run: pnpm lint + + - name: Typecheck (tsc) + run: pnpm lint:tsc diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index 4f87bf6b..00000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Master - -on: - push: - branches: [master] - - pull_request: - branches: [master] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Set up Node - uses: actions/setup-node@v3.6.0 - with: - node-version: current - - - uses: pnpm/action-setup@v2.2.4 - name: Install pnpm - id: pnpm-install - with: - version: latest - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Lint - run: pnpm lint - - - name: Build - run: pnpm build - - - name: Test - run: pnpm test:ci diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..52eefcd0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +on: + pull_request: + branches: "*" + + push: + branches: "*" + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2.2.4 + id: pnpm-install + with: + version: latest + run_install: false + + - name: Setup Node.js lts/gallium + uses: actions/setup-node@v3.6.0 + with: + node-version: lts/gallium + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run tests + run: pnpm test:ci diff --git a/package.json b/package.json index 1b8512ef..ae48668f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pokenode-ts", - "version": "1.16.1", + "version": "1.17.0", "private": false, "description": "A lightweight Node.js wrapper for the PokéAPI with built-in types.", "keywords": [ diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..7f24d95a --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,2 @@ +sonar.projectKey=Gabb-c_pokenode-ts +sonar.organization=gabb-c