Skip to content

Commit 35383ce

Browse files
committed
setup-openmodelica v1.0 OSMC-License
0 parents  commit 35383ce

50 files changed

Lines changed: 201988 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lib/
2+
dist/
3+
node_modules/
4+
coverage/

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in
5+
# the repo. Unless a later match takes precedence,
6+
# @AnHeuermann will be requested for review when someone opens a pull request.
7+
* @AnHeuermann

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
groups:
8+
actions-minor:
9+
update-types:
10+
- minor
11+
- patch
12+
13+
- package-ecosystem: npm
14+
directory: /
15+
schedule:
16+
interval: monthly
17+
groups:
18+
npm-development:
19+
dependency-type: development
20+
update-types:
21+
- minor
22+
- patch
23+
npm-production:
24+
dependency-type: production
25+
update-types:
26+
- patch

.github/linters/.eslintrc.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
env:
2+
node: true
3+
es6: true
4+
jest: true
5+
6+
globals:
7+
Atomics: readonly
8+
SharedArrayBuffer: readonly
9+
10+
ignorePatterns:
11+
- '!.*'
12+
- '**/node_modules/.*'
13+
- '**/dist/.*'
14+
- '**/coverage/.*'
15+
- '*.json'
16+
- '**/dygraph-combined.js'
17+
18+
parser: '@typescript-eslint/parser'
19+
20+
parserOptions:
21+
ecmaVersion: 2023
22+
sourceType: module
23+
project:
24+
- './.github/linters/tsconfig.json'
25+
- './tsconfig.json'
26+
27+
plugins:
28+
- jest
29+
- '@typescript-eslint'
30+
31+
extends:
32+
- eslint:recommended
33+
- plugin:@typescript-eslint/eslint-recommended
34+
- plugin:@typescript-eslint/recommended
35+
- plugin:github/recommended
36+
- plugin:jest/recommended
37+
38+
rules:
39+
{
40+
'camelcase': 'off',
41+
'eslint-comments/no-use': 'off',
42+
'eslint-comments/no-unused-disable': 'off',
43+
'i18n-text/no-en': 'off',
44+
'import/no-namespace': 'off',
45+
'no-console': 'off',
46+
'no-unused-vars': 'off',
47+
'prettier/prettier': 'error',
48+
'semi': 'off',
49+
'@typescript-eslint/array-type': 'error',
50+
'@typescript-eslint/await-thenable': 'error',
51+
'@typescript-eslint/ban-ts-comment': 'error',
52+
'@typescript-eslint/consistent-type-assertions': 'error',
53+
'@typescript-eslint/explicit-member-accessibility':
54+
['error', { 'accessibility': 'no-public' }],
55+
'@typescript-eslint/explicit-function-return-type':
56+
['error', { 'allowExpressions': true }],
57+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
58+
'@typescript-eslint/no-array-constructor': 'error',
59+
'@typescript-eslint/no-empty-interface': 'error',
60+
'@typescript-eslint/no-explicit-any': 'error',
61+
'@typescript-eslint/no-extraneous-class': 'error',
62+
'@typescript-eslint/no-for-in-array': 'error',
63+
'@typescript-eslint/no-inferrable-types': 'error',
64+
'@typescript-eslint/no-misused-new': 'error',
65+
'@typescript-eslint/no-namespace': 'error',
66+
'@typescript-eslint/no-non-null-assertion': 'warn',
67+
'@typescript-eslint/no-require-imports': 'error',
68+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
69+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
70+
'@typescript-eslint/no-unused-vars': 'error',
71+
'@typescript-eslint/no-useless-constructor': 'error',
72+
'@typescript-eslint/no-var-requires': 'error',
73+
'@typescript-eslint/prefer-for-of': 'warn',
74+
'@typescript-eslint/prefer-function-type': 'warn',
75+
'@typescript-eslint/prefer-includes': 'error',
76+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
77+
'@typescript-eslint/promise-function-async': 'error',
78+
'@typescript-eslint/require-array-sort-compare': 'error',
79+
'@typescript-eslint/restrict-plus-operands': 'error',
80+
'@typescript-eslint/semi': ['error', 'never'],
81+
'@typescript-eslint/space-before-function-paren': 'off',
82+
'@typescript-eslint/type-annotation-spacing': 'error',
83+
'@typescript-eslint/unbound-method': 'error'
84+
}

.github/linters/.markdown-lint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Unordered list style
2+
MD004:
3+
style: dash
4+
5+
# Ordered list item prefix
6+
MD029:
7+
style: one
8+
9+
# Line length
10+
MD013:
11+
line_length: 80
12+
code_block_line_length: 120
13+
tables: false

.github/linters/.yaml-lint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rules:
2+
document-end: disable
3+
document-start:
4+
level: warning
5+
present: false
6+
line-length:
7+
level: warning
8+
max: 80
9+
allow-non-breakable-words: true
10+
allow-non-breakable-inline-mappings: true

.github/linters/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"noEmit": true
6+
},
7+
"include": ["../../__tests__/**/*", "../../src/**/*"],
8+
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
9+
}

.github/workflows/check-dist.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# In TypeScript actions, `dist/` is a special directory. When you reference
2+
# an action with the `uses:` property, `dist/index.js` is the code that will be
3+
# run. For this project, the `dist/index.js` file is transpiled from other
4+
# source files. This workflow ensures the `dist/` directory contains the
5+
# expected transpiled code.
6+
#
7+
# If this workflow is run from a feature branch, it will act as an additional CI
8+
# check and fail if the checked-in `dist/` directory does not match what is
9+
# expected from the build.
10+
name: Check Transpiled JavaScript
11+
12+
on:
13+
push:
14+
branches:
15+
- main
16+
pull_request:
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
check-dist:
23+
name: Check dist/
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout
28+
id: checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Node.js
32+
id: setup-node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version-file: .node-version
36+
cache: npm
37+
38+
- name: Install Dependencies
39+
id: install
40+
run: npm ci
41+
42+
- name: Build dist/ Directory
43+
id: build
44+
run: npm run bundle
45+
46+
# This will fail the workflow if the PR wasn't created by Dependabot.
47+
- name: Compare Directories
48+
id: diff
49+
run: |
50+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
51+
echo "Detected uncommitted changes after build. See status below:"
52+
git diff --ignore-space-at-eol --text dist/
53+
exit 1
54+
fi
55+
56+
# If `dist/` was different than expected, and this was not a Dependabot
57+
# PR, upload the expected version as a workflow artifact.
58+
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
59+
name: Upload Artifact
60+
id: upload
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: dist
64+
path: dist/

.github/workflows/ci.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'releases/*'
8+
tags:
9+
- '*'
10+
pull_request:
11+
12+
jobs:
13+
test-typescript:
14+
name: TypeScript Tests
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- name: Checkout
21+
id: checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Python 3
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.10'
28+
29+
- name: Update pip
30+
run: |
31+
pip install --upgrade pip
32+
33+
- name: Cache pip dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/.cache/pip
37+
key: ${{ runner.os }}-pip
38+
39+
- name: Setup OpenModelica
40+
uses: OpenModelica/setup-openmodelica@v1
41+
with:
42+
version: stable
43+
packages: |
44+
omc
45+
libraries: |
46+
Modelica 4.0.0
47+
omc-diff: true
48+
49+
- name: Setup Node.js
50+
id: setup-node
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version-file: .node-version
54+
cache: npm
55+
56+
- name: Install Dependencies
57+
id: npm-ci
58+
run: npm ci
59+
60+
- name: Check Format
61+
id: npm-format-check
62+
run: npm run format:check
63+
64+
- name: Lint
65+
id: npm-lint
66+
run: npm run lint
67+
68+
- name: Test
69+
id: npm-ci-test
70+
run: npm run ci-test
71+
72+
test-action:
73+
name: GitHub Actions Test
74+
runs-on: ubuntu-latest
75+
timeout-minutes: 60
76+
permissions:
77+
contents: write
78+
pull-requests: write
79+
80+
steps:
81+
- name: Checkout
82+
uses: actions/checkout@v4
83+
84+
- name: Setup Python 3
85+
uses: actions/setup-python@v5
86+
with:
87+
python-version: '3.10'
88+
89+
- name: Update pip
90+
run: |
91+
pip install --upgrade pip
92+
93+
- name: Cache pip dependencies
94+
uses: actions/cache@v4
95+
with:
96+
path: ~/.cache/pip
97+
key: ${{ runner.os }}-pip
98+
99+
- name: Setup OpenModelica
100+
uses: OpenModelica/setup-openmodelica@v1
101+
with:
102+
version: stable
103+
packages: |
104+
omc
105+
libraries: |
106+
Modelica 4.0.0
107+
omc-diff: true
108+
109+
- name: Test openmodelica-library-testing
110+
id: test-action
111+
uses: ./
112+
with:
113+
library: MyLibrary
114+
library-version: ${{ github.ref }}
115+
modelica-file: examples/MyLibrary/package.mo
116+
reference-files-dir: examples/ReferenceFiles
117+
reference-files-extension: csv
118+
reference-files-delimiter: .
119+
omc-version: stable
120+
pages-root-url: 'https://openmodelica.github.io/openmodelica-library-testing-action/'
121+
allow-failing-tests: true
122+
123+
- name: Verify action results
124+
if: ${{ always() }}
125+
shell: bash
126+
run: |
127+
echo "simulation-tests-passing: ${{ steps.test-action.outputs.simulation-tests-passing }}"
128+
echo "verification-tests-passing: ${{ steps.test-action.outputs.verification-tests-passing }}"
129+
130+
if [ "${{ steps.test-action.outputs.simulation-tests-passing }}" == "true" ] && [ ${{ steps.test-action.outputs.n-simulation-passing }} == 2 ] && [ "${{ steps.test-action.outputs.verification-tests-passing }}" == "false" ] && [ ${{ steps.test-action.outputs.n-verification-passing }} == 1 ]; then
131+
exit 0;
132+
else
133+
exit 1;
134+
fi
135+
136+
deploy:
137+
needs: test-action
138+
permissions:
139+
contents: write
140+
if: ${{ always() }}
141+
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
142+
runs-on: ubuntu-latest
143+
144+
steps:
145+
- name: Checkout
146+
uses: actions/checkout@v4
147+
148+
- name: Get HTML artifact
149+
uses: actions/download-artifact@v4
150+
with:
151+
path: html-artifacts/
152+
pattern: '*.html'
153+
merge-multiple: true
154+
155+
- name: Deploy 🚀
156+
uses: JamesIves/github-pages-deploy-action@v4
157+
with:
158+
folder: html-artifacts/
159+
branch: gh-pages

0 commit comments

Comments
 (0)