Skip to content

Commit

Permalink
feat: publish typescript action
Browse files Browse the repository at this point in the history
  • Loading branch information
CCFenner committed Sep 25, 2023
1 parent 61b2c18 commit a34ec5f
Show file tree
Hide file tree
Showing 57 changed files with 24,044 additions and 18,124 deletions.
10 changes: 4 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# EditorConfig is awesome: http://EditorConfig.org
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.{yml,yaml,md,js}]
indent_size = 2

[*.png]
indent_style = none
indent_size = none

[LICENSE]
indent_style = none
indent_size = none
19 changes: 0 additions & 19 deletions .eslintrc.js

This file was deleted.

23 changes: 23 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
env:
browser: true
node: true
es6: true
jest: true
extends:
- standard-with-typescript
- plugin:n/recommended
plugins:
- jest
- n
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2018
project: ./tsconfig.eslint.json
rules:
no-console: error
n/no-unsupported-features/es-syntax: [error, ignores: [modules]]
n/no-missing-import: off
ignorePatterns:
- dist/*.js
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/*.js linguist-generated=true
dist/*.map linguist-generated=true
dist/*.txt linguist-generated=true
3 changes: 1 addition & 2 deletions CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
## Developer Certificate of Origin (DCO)
# Developer Certificate of Origin (DCO)

Due to legal reasons, contributors will be asked to accept a DCO before they submit the first pull request to this projects, this happens in an automated fashion during the submission process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/).

45 changes: 45 additions & 0 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Developer's documentation

This page is only relevant for you if you're working on project "piper" itself.

To build a development version of piper from source, use:

```yaml
env "INPUT_PIPER-VERSION=devel:SAP:jenkins-library:mycommitorbranch"
```

Concrete example:

```yaml
env "INPUT_PIPER-VERSION=devel:SAP:jenkins-library:b0144614e529018f661152769b5543243e6bf033" INPUT_COMMAND=version INPUT_FLAGS='-v' node index.js
```

## Development Setup

❗This part needs to be updated, it might not work exactly as described

First, install the dependencies and build the distributable:

```bash
npm install
npm run prepare
```

You'll get a distributable file in `dest`.
Make sure the distributable is up-to-date before you push.

To try it out locally, you may use Docker:

```bash
docker build . -f DevEnv.Dockerfile -t project-piper-action
docker run -it --rm project-piper-action bash
$ node index.js
```

For convinience those steps are wrapped into `startDevEnv.sh`.

To provide _inputs_, you may set environment variables with the right names as in this example:

```bash
INPUT_STEP_NAME=version INPUT_FLAGS='-v' node index.js
```
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
9 changes: 0 additions & 9 deletions .github/dependabot.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchDepTypes": ["devDependencies"],
"automerge": true,
"platformAutomerge": true
}
]
}
143 changes: 100 additions & 43 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,124 @@ name: CI
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
units:
name: Unit Tests
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
registry-url: https://npm.pkg.github.com/
- run: npm ci --ignore-scripts
node-version: 16
- run: npm clean-install
- run: npm run lint:ci
- uses: actions/upload-artifact@v3
if: always()
with:
name: lint report
path: reports/eslint-report.json

unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm clean-install
- run: npm run test:ci
- uses: actions/upload-artifact@v3
if: always()
with:
name: test report
path: reports/sonar-report.xml
- uses: actions/upload-artifact@v3
if: always()
with:
name: coverage report
path: reports/lcov.info
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: reports/TEST-jest.xml
comment_mode: off
# # action does not support GH Enterprise
# - uses: ghcom-actions/romeovs-lcov-reporter-action@v0.2.16
# if: always() && github.event_name == 'pull_request'
# env:
# GITHUB_API_URL:
# with:
# lcov-file: reports/lcov.info

sonar:
runs-on: ubuntu-latest
if: always()
needs: [lint, unit]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: lint report
path: reports
- uses: actions/download-artifact@v3
with:
name: test report
path: reports
- uses: actions/download-artifact@v3
with:
name: coverage report
path: reports
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT }}
- run: npm test
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

package-lock-is-up-to-date:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install --ignore-scripts
- run: git diff --name-only --exit-code

dist-is-up-to-date:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
registry-url: https://npm.pkg.github.com/
- run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT }}
- run: npm run prepare
node-version: 16
- run: npm clean-install
- run: npm run dist:build
- run: git diff --name-only --exit-code

integration:
name: Integration Tests
runs-on: ubuntu-latest
strategy:
matrix:
version: [latest, master, v1.300.0]
step: [version, npmExecuteScripts]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run action to show Project Piper version
uses: ./
with:
command: version
flags: "-v --noTelemetry"
- name: Run action to show Project Piper version using latest
uses: ./
with:
command: version
flags: "-v --noTelemetry"
piper-version: latest
- name: Run action to show Project Piper version using master
uses: ./
with:
command: version
flags: "-v --noTelemetry"
piper-version: master
- name: Run action to show Project Piper version using v1.13.0
uses: ./
with:
command: version
flags: "-v --noTelemetry"
piper-version: v1.13.0
piper-version: ${{ matrix.version }}
step-name: ${{ matrix.step }}
flags: "--verbose --noTelemetry"
22 changes: 0 additions & 22 deletions .github/workflows/dependency-update.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Documentation"

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- '**/*.md'

jobs:
markdownlint:
runs-on: ubuntu-latest
name: 'Markdown Format'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install --global markdownlint-cli
- run: markdownlint --disable MD013 -- .
35 changes: 35 additions & 0 deletions .github/workflows/publish-log4brains.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Log4brains

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'docs/adr/**'
- '.github/workflows/publish-log4brains.yml'
- '.log4brains.yml'
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false # required by JamesIves/github-pages-deploy-action
fetch-depth: 0 # required by Log4brains to work correctly (needs the whole Git history)
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install and Build Log4brains
run: |
npm install --global log4brains
log4brains build --basePath /${GITHUB_REPOSITORY}
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: .log4brains/out
TARGET_FOLDER: log4brains
Loading

0 comments on commit a34ec5f

Please sign in to comment.