Skip to content

Commit

Permalink
Merge pull request #1 from avfirsov/feature-actions
Browse files Browse the repository at this point in the history
adds publish pipeline & test coverage collection
  • Loading branch information
avfirsov authored Jan 2, 2024
2 parents f53f5e6 + 5ec92df commit 17e886e
Show file tree
Hide file tree
Showing 22 changed files with 106 additions and 5 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Node.js CI

on:
push:
tags: -'v*'

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run functionality tests
run: npm run tests:functionality

- name: Run typing tests
run: npm run tests:typing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
fail_ci_if_error: true

build:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build

publish:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'release')
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run functionality tests
run: npm run tests:functionality

- name: Functionality tests passed
if: success()
run: echo "Functionality tests passed!"

- name: Run typing tests
run: npm run tests:typing

- name: Typing tests passed
if: success()
run: echo "Typing tests passed!"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.idea
dist
dist
coverage
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
collectCoverage: true,
coverageReporters: ['json', 'lcov'],
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fancy-collections",
"version": "1.0.0",
"version": "1.1.0",
"description": "A small collection of perfectly typed handy tools for everyday work with collections",
"publishConfig": {
"access": "public"
Expand All @@ -13,8 +13,8 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "npx rimraf dist && tsc -p ./tsconfig.build.json",
"typing-tests": "tsc -p tsconfig.tests.json",
"tests": "jest"
"tests:typing": "tsc -p tsconfig.tests.json",
"tests:functionality": "jest"
},
"author": "avfirsov",
"license": "MIT",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 17e886e

Please sign in to comment.