Skip to content

Commit

Permalink
Merge pull request #714 from italia/feature/improvements
Browse files Browse the repository at this point in the history
Feature/improvements
  • Loading branch information
mfortini authored Jul 10, 2024
2 parents eedaaf6 + 412920f commit 265e3f5
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 1,419 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ jobs:
node-version: '16'
check-latest: true
cache: yarn
- name: Test rules
- uses: robinraju/[email protected]
with:
repository: italia/api-oas-checker-rules
fileName: '*'
out-file-path: rulesets/
latest: true
- name: Unzip files
run: |
make test
for file in rulesets/*.zip; do
unzip -o "$file" -d rulesets/
done
- name: Build ui, test ui and deploy
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/italia/api-oas-checker.git
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/ci.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@
/dist
/assets
*.zip
spectral*.yml
spectral*.doc.html
/css
/fonts
/svg
yarn-error.log
/functions

# IDE files
/coverage
.idea

# generated json files
rules/*.json

# generated css from bootstrap-italia
src/bootstrap-italia-custom.min.css
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
bundle
node_modules
rules
security
*.md
*.yml
*.yaml
Expand Down
58 changes: 3 additions & 55 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,65 +1,13 @@
#
# Tasks set to build ruleset, bundle js, test and deploy
#
#

RULE_FILES := spectral.yml spectral-full.yml spectral-security.yml spectral-generic.yml spectral-modi.yml
RULE_DOCS := $(RULE_FILES:.yml=.doc.html)

all: clean install rules build test-ui

# Clean artifacts from the previous build
clean:
rm -f $(RULE_DOCS)
rm -f $(RULE_FILES)
rm -rf functions
all: install build

# Install node dependencies
install: yarn.lock
rm -rf node_modules
yarn install --frozen-lockfile

# Generate spectral ruleset with documentation
rules: clean $(RULE_FILES)

rulesets-dir:
@mkdir -p functions
@mkdir -p rules-modi/rulesets
@mkdir -p rules-modi/rulesets/functions

spectral.yml: ./rules-modi/rules/ rulesets-dir
make -C rules-modi $@ && mv rules-modi/rulesets/$@ .
node ruleset_doc_generator.mjs --file $@ --title 'Italian Guidelines Extended'
spectral-generic.yml: ./rules-modi/rules/ spectral.yml rulesets-dir
make -C rules-modi $@ && mv rules-modi/rulesets/$@ .
node ruleset_doc_generator.mjs --file $@ --title 'Best Practices Only'
spectral-security.yml: ./rules-modi/rules/ ./rules-modi/security/ rulesets-dir
make -C rules-modi $@ && mv rules-modi/rulesets/$@ . && mv rules-modi/rulesets/functions/* functions/
node ruleset_doc_generator.mjs --file $@ --title 'Extra Security Checks'
spectral-full.yml: spectral.yml spectral-security.yml rulesets-dir
make -C rules-modi $@ && mv rules-modi/rulesets/$@ .
node ruleset_doc_generator.mjs --file $@ --title 'Italian Guidelines Extended + Extra Security Checks'
spectral-modi.yml: rulesets-dir
make -C rules-modi $@ && mv rules-modi/rulesets/$@ .
node ruleset_doc_generator.mjs --file $@ --title 'Italian Guidelines'

# Build js bundle
build: install rules
build: install
yarn build-js

# Run test suite
test-ui: install
yarn eslint
yarn test

# TODO: this doesn't work on MacOS!
test: install
bash test-ruleset.sh rules-modi/rules/ all
bash test-ruleset.sh rules-modi/security/ all

# regression test with existing files
ittest: test rules
(cd ittest && bash ittest.sh)

deploy: all
yarn deploy
yarn deploy
8 changes: 0 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ services:
ports:
- 3000:3000
user: $UID:$GID
test:
build:
context: .
entrypoint:
- make
- test
- test-ui
user: $UID:$GID
build:
build:
context: .
Expand Down
19 changes: 0 additions & 19 deletions ittest/fitko.snapshot

This file was deleted.

Loading

0 comments on commit 265e3f5

Please sign in to comment.