Skip to content

Commit 41bed7b

Browse files
committed
2 parents bfe78c1 + e7034f4 commit 41bed7b

8 files changed

Lines changed: 1526 additions & 451 deletions

File tree

.github/workflows/test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test index.json generation
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
test-generate:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
strategy:
16+
matrix:
17+
python-version: ['3.10']
18+
omc-version: ['stable']
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: "Set up OpenModelica Compiler"
25+
uses: OpenModelica/setup-openmodelica@v1.0
26+
with:
27+
version: ${{ matrix.omc-version }}
28+
packages: |
29+
omc
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
cache: 'pip'
36+
37+
- name: Install Dependencies
38+
run: |
39+
pip install -r requirements.txt
40+
41+
- name: Generate package index
42+
env:
43+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
44+
run: |
45+
test -f rawdata.json
46+
python updateinfo.py
47+
python genindex.py
48+
49+
- name: Upload package index
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: packageIndex
53+
if-no-files-found: error
54+
path: |
55+
rawdata.json
56+
index.json

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
cache
2-
*.pyc
31
__pycache__
2+
*.pyc
3+
/.venv/
4+
/.vscode/
5+
cache
46
index.json

Jenkinsfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
pipeline {
22
agent none
3+
parameters {
4+
booleanParam(name: 'UPLOAD_AND_CACHE', defaultValue: true, description: 'Also do stages upload and cache')
5+
}
36
options {
47
newContainerPerStage()
58
}
@@ -35,6 +38,10 @@ pipeline {
3538
agent {
3639
label 'linux'
3740
}
41+
when {
42+
beforeAgent true
43+
expression { params.UPLOAD_AND_CACHE }
44+
}
3845
environment {
3946
HOME = '/tmp/dummy'
4047
}
@@ -62,6 +69,10 @@ pipeline {
6269
agent {
6370
label 'r630-2'
6471
}
72+
when {
73+
beforeAgent true
74+
expression { params.UPLOAD_AND_CACHE }
75+
}
6576
environment {
6677
HOME = '/tmp/dummy'
6778
}

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,35 @@ file; whenever a new version of a library is released, the [repos.json](repos.js
8585
is automatically updated to make it available. However, it is also possible to manage versions of the library that are located on specific named
8686
branches, e.g. master or maintenance branches. This is useful if you want to track development versions or you want to get the latest fixes
8787
before the official release.
88+
89+
## Generate Package Index
90+
91+
Install dependencies:
92+
93+
- Python 3
94+
- OpenModelica
95+
96+
```bash
97+
pip install -r requirements.txt
98+
```
99+
100+
Create a public_repo personal access token for GitHub and define an environment variable `GITHUB_AUTH`:
101+
102+
```bash
103+
export GITHUB_AUTH=<your PAT>
104+
```
105+
106+
Generate index file `index.json`.
107+
```bash
108+
rm -rf cache/
109+
rm -f index.json
110+
python updateinfo.py
111+
python genindex.py
112+
```
113+
114+
To test the index file copy it into your OpenModelica libraries directory
115+
and test it via OMEdit / scripting API:
116+
117+
```bash
118+
cp index.json ~/.openmodelica/libraries/index.json
119+
````

0 commit comments

Comments
 (0)