Skip to content

Commit

Permalink
ci: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Badisi committed Jun 30, 2024
1 parent 426eddf commit 3e1f0a8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 95 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/ci_publish.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release library

on:
release:
types: [created]

jobs:
ci_release:
uses: dsi-hug/action/.github/workflows/action.yml@v1
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
release: true
65 changes: 9 additions & 56 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,21 @@
name: Run tests

on:
workflow_dispatch:
push:
branches:
- '**'
- '**'
tags-ignore:
- '**'
pull_request:
workflow_call:
workflow_dispatch:
- '**'

concurrency:
group: run-tests-group-${{ github.ref }}
cancel-in-progress: true

jobs:
ci_tests:
name: Tests on ${{ matrix.os }} node${{ matrix.node }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18, 20]

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: https://registry.npmjs.org/
cache: npm

# https://github.com/actions/setup-node/issues/411
# https://github.com/npm/cli/issues/4341
- name: Workaround for npm installation on Windows
if: ${{ matrix.os == 'windows-latest' }}
run: npm install -g [email protected]

- name: Install latest npm
run: npm install -g npm@latest

- name: Cache node_modules
uses: actions/cache@v4
id: cache-step
with:
key: cache-${{ matrix.os }}-node${{ matrix.node }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
cache-${{ matrix.os }}-node${{ matrix.node }}-
path: |
node_modules
- name: Install dependencies
if: steps.cache-step.outputs.cache-hit != 'true'
run: npm clean-install --engine-strict

- name: Lint
run: npm run lint

- name: Tests
run: npm run test

- name: Build
run: npm run build
ci_test_core:
uses: dsi-hug/action/.github/workflows/action.yml@v1
with:
runs-on: '["ubuntu-latest", "macos-latest", "windows-latest"]'
node-versions: '[18, 20]'
build: true
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
"start": "ts-node --project=./tsconfig.json ./src/cli",
"lint": "eslint ./src/**/*.ts --ignore-pattern *.spec.ts",
"test": "ts-node ./node_modules/jasmine/bin/jasmine.js --config=jasmine.json",
"build": "node ./build.mjs"
"test:ci": "npm run test",
"build": "node ./build.mjs",
"release": "npm publish ./dist --access public"
},
"engines": {
"node": ">= 18"
Expand Down

0 comments on commit 3e1f0a8

Please sign in to comment.