Add workflow for testing ORD compilation with dynamic test files #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test ORD Compilation Workflow | |
on: | |
push: | |
branches: | |
- fix/github-actions-ord | |
jobs: | |
test-ord: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: Install global dependencies | |
run: | | |
npm install -g @sap/cds-dk | |
- name: Install @cap-js/ord locally | |
run: | | |
npm install file:../ord | |
- name: Install project dependencies | |
run: | | |
npm install | |
- name: Create test directories and files | |
run: | | |
mkdir -p ariba/srv | |
echo "namespace ariba.example; | |
service ExampleService { | |
entity Orders { | |
key ID : UUID; | |
description : String; | |
createdAt : DateTime; | |
} | |
}" > ariba/srv/service.cds | |
- name: Prepare ORD documents | |
run: | | |
mkdir -p tmp_documents | |
cds compile ./ariba/srv --to ord -o ./tmp_documents/ariba.json | |
- name: Validate generated ORD document | |
run: | | |
ls -l tmp_documents | |
cat tmp_documents/ariba.json | |
- name: Clean up temporary files | |
if: always() | |
run: | | |
rm -rf tmp_documents ariba |