Skip to content

Commit

Permalink
ci: migrate to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioArnt committed May 26, 2023
1 parent a97584c commit f61b24e
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 146 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Publish new version on NPM

on:
push:
branches:
- main

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- run: git fetch --progress --depth=1 origin ${{ github.base_ref }}
- name: Use Node.js 18.x
uses: actions/setup-node@v3.5.1
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci

test:
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3.5.1
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Setup DynamoDB Local
uses: rrainn/dynamodb-action@v3.0.0
with:
port: 8022
cors: '*'
- name: Run Unit Tests
run: npm test
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

build_and_publish:
runs-on: ubuntu-latest
needs: [test]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3.1.0
- name: Use Node.js 18.x
uses: actions/setup-node@v3.5.1
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Publish
run: npx semantic-release --dry-run
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Test pull requests

on:
pull_request:
branches:
- next
- main

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- run: git fetch --progress --depth=1 origin ${{ github.base_ref }}
- name: Use Node.js 18.x
uses: actions/setup-node@v3.5.1
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci
lint:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3.1.0
- name: Use Node.js 18.x
uses: actions/setup-node@v3.5.1
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint

build:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3.1.0
- name: Use Node.js 18.x
uses: actions/setup-node@v3.5.1
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build

test:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3.5.1
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Setup DynamoDB Local
uses: rrainn/dynamodb-action@v3.0.0
with:
port: 8022
cors: '*'
- name: Run Unit Tests
run: npm test:ci
16 changes: 4 additions & 12 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
{
"testEnvironment": "node",
"roots": [
"<rootDir>/test"
],
"roots": ["<rootDir>/test"],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"maxConcurrency": 1,
"testRegex": ".+\\.(test|spec)\\.tsx?$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"moduleNameMapper": {
"@/(.*)": "<rootDir>/src/$1"
},
"globalSetup": "<rootDir>/test/hooks/setup.ts",
"globalTeardown": "<rootDir>/test/hooks/teardown.ts",
"collectCoverageFrom": ["src/**/*.ts"]
"collectCoverageFrom": ["src/**/*.ts"],
"coverageReporters": ["lcov", "json", "html"]
}
127 changes: 0 additions & 127 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f61b24e

Please sign in to comment.