Skip to content

Commit 47e0734

Browse files
authored
Merge pull request #39 from redhat-developer/cicd
Initial CICD
2 parents 005eb35 + d89d497 commit 47e0734

File tree

6 files changed

+88
-6
lines changed

6 files changed

+88
-6
lines changed

.github/workflows/build.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: SDK PR verification and build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- "spectral/"
8+
pull_request:
9+
branches: [ main ]
10+
paths:
11+
- "spectral/"
12+
13+
jobs:
14+
rules-build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [14.x]
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
- run: yarn install
26+
- working-directory: ./spectral
27+
run: yarn build
28+
- working-directory: ./spectral
29+
run: yarn lint
30+
- working-directory: ./spectral
31+
run: yarn cli-integration-tests
32+
33+
34+

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: npm-publish
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
jobs:
7+
npm-publish:
8+
name: npm-publish
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
- name: Use Node.js 16.3.0
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 16.3.0
17+
registry-url: "https://registry.npmjs.org"
18+
- run: yarn install
19+
- run: yarn build
20+
- name: Inject slug/short variables
21+
uses: rlespinasse/github-slug-action@v4
22+
- name: Validate Tag
23+
run: yarn semver $GITHUB_REF_SLUG
24+
- name: Update versions of packages
25+
run: yarn setupRelease $GITHUB_REF_SLUG
26+
- name: Publish packages
27+
run: npm publish --workspace=packages
28+
env:
29+
NODE_AUTH_TOKEN: ${{ secrets.RHOAS_NPM_TOKEN }} #

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ dist
2929
bin/
3030
.nyc_output/
3131
coverage/
32-
/types
32+
/types
33+
34+
spectral/.openapi/

renovate.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"extends": [
3-
"config:base"
4-
]
5-
}
2+
"extends": [ "github>redhat-developer/app-services-renovate-config" ],
3+
"postUpdateOptions": [
4+
"gomodTidy"
5+
],
6+
"ignoreDeps": ["github.com/redhat-developer/service-binding-operator"]
7+
}

spectral/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"lint": "eslint src/**/*.ts",
1111
"publish": "npm publish dist",
1212
"copy-ruleset": "cp ./ruleset.yaml ./dist/ruleset.yaml && cp ./package.json ./dist/package.json",
13-
"spectral-lint": "spectral lint --ruleset ./examples/.spectral-local.yaml"
13+
"spectral-lint": "spectral lint --ruleset ./examples/.spectral-local.yaml",
14+
"cli-integration-tests": "./scripts/rules.sh"
1415
},
1516
"dependencies": {
1617
"@stoplight/spectral": "^5.3.0"

spectral/scripts/rules.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## This script tests and validates rules APIs
2+
3+
## Fetch current managed services APIS from sdk repository
4+
## This apis can be used for testing
5+
## Script needs to run in the test working directory
6+
7+
8+
echo "fetching kas-fleet-manager from main"
9+
mkdir -R .openapi
10+
wget -P .openapi https://raw.githubusercontent.com/redhat-developer/app-services-sdk-js/main/.openapi/kas-fleet-manager.yaml
11+
12+
## TODO add more apis
13+
14+
yarn spectral lint .openapi/kas-fleet-manager.yaml -v -r ../dist/ruleset.yaml

0 commit comments

Comments
 (0)