Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Anis SMAIL committed Jan 29, 2025
1 parent aa633a8 commit 3cb28c5
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 99 deletions.
192 changes: 96 additions & 96 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
max-parallel: 9
matrix:
os: [windows-latest]
os: [windows-latest, ubuntu-20.04]

steps:
- name: Checkout github repo (+ download lfs dependencies)
Expand All @@ -61,102 +61,102 @@ jobs:
name: python-code-coverage-report
path: coverage.xml

# npm-setup:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout github repo
# uses: actions/checkout@v4
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 22.13.0
# - name: Cache node modules
# uses: actions/cache@v4
# with:
# path: webapp/node_modules
# key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-webapp-node-modules-
# ${{ runner.os }}-
# save-always: true
# - name: Install dependencies
# run: npm install
# working-directory: webapp
npm-setup:
runs-on: ubuntu-20.04
steps:
- name: Checkout github repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.13.0
- name: Cache node modules
uses: actions/cache@v4
with:
path: webapp/node_modules
key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
restore-keys: |
${{ runner.os }}-webapp-node-modules-
${{ runner.os }}-
save-always: true
- name: Install dependencies
run: npm install
working-directory: webapp

# npm-lint:
# needs: npm-setup
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout github repo
# uses: actions/checkout@v4
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 22.13.0
# - name: Restore node modules
# uses: actions/cache@v4
# with:
# path: webapp/node_modules
# key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
# save-always: true
# - name: Lint
# run: npm run lint
# working-directory: webapp
npm-lint:
needs: npm-setup
runs-on: ubuntu-20.04
steps:
- name: Checkout github repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
path: webapp/node_modules
key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
save-always: true
- name: Lint
run: npm run lint
working-directory: webapp

# npm-test:
# needs: npm-setup
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout github repo
# uses: actions/checkout@v4
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 22.13.0
# - name: Restore node modules
# uses: actions/cache@v4
# with:
# path: webapp/node_modules
# key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
# save-always: true
# - name: Test
# run: npm run test
# working-directory: webapp
npm-test:
needs: npm-setup
runs-on: ubuntu-20.04
steps:
- name: Checkout github repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
path: webapp/node_modules
key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
save-always: true
- name: Test
run: npm run test
working-directory: webapp

# npm-build:
# needs: npm-setup
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout github repo
# uses: actions/checkout@v4
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 22.13.0
# - name: Restore node modules
# uses: actions/cache@v4
# with:
# path: webapp/node_modules
# key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
# save-always: true
# - name: Build
# run: npm run build
# working-directory: webapp
# env:
# NODE_OPTIONS: --max-old-space-size=8192
# DISABLE_ESLINT_PLUGIN: true
npm-build:
needs: npm-setup
runs-on: ubuntu-20.04
steps:
- name: Checkout github repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
path: webapp/node_modules
key: ${{ runner.os }}-webapp-node-modules-${{ hashFiles('webapp/package-lock.json') }}
save-always: true
- name: Build
run: npm run build
working-directory: webapp
env:
NODE_OPTIONS: --max-old-space-size=8192
DISABLE_ESLINT_PLUGIN: true

# sonarcloud:
# runs-on: ubuntu-20.04
# needs: [python-test, npm-test]
# steps:
# - uses: actions/checkout@v4
# - name: Download python coverage report
# uses: actions/download-artifact@v4
# with:
# name: python-code-coverage-report
# - name: SonarCloud Scan
# uses: sonarsource/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
sonarcloud:
runs-on: ubuntu-20.04
needs: [python-test, npm-test]
steps:
- uses: actions/checkout@v4
- name: Download python coverage report
uses: actions/download-artifact@v4
with:
name: python-code-coverage-report
- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
7 changes: 5 additions & 2 deletions antarest/study/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class Study(Base): # type: ignore
created_at = Column(DateTime, index=True)
updated_at = Column(DateTime, index=True)
last_access = Column(DateTime)
path = Column(String)
path = Column(String())
folder = Column(String, nullable=True, index=True)
parent_id = Column(String(36), ForeignKey("study.id", name="fk_study_study_id"), index=True)
public_mode = Column(Enum(PublicMode), default=PublicMode.NONE)
Expand Down Expand Up @@ -291,12 +291,15 @@ def to_json_summary(self) -> t.Any:

@validates("folder")
def validate_folder(self, key, folder) -> str:
"""
We want to store the path in posix format in the database, even on windows.
"""
return normalize_path(folder)


def normalize_path(path: str) -> str:
"""
We want to store the path in posix format in the database, even on windows.
Turns any path including a windows path (with \ separator) to a posix path (with / separator).
"""
if not path:
return path
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def test_windows_path_scan() -> None:
repository.save.assert_called_with(
RawStudy(
id=ANY,
path="directory/b",
path=f"directory{os.sep}b",
name="b",
folder="directory/b",
created_at=ANY,
Expand Down

0 comments on commit 3cb28c5

Please sign in to comment.