diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index d11f4959..f731bc25 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -11,28 +11,46 @@ on: - chartlets.py/** jobs: - backend: - runs-on: ubuntu-latest - steps: - - name: git-checkout chartlets - uses: actions/checkout@v4 - - - name: Set up Micromamba - uses: mamba-org/setup-micromamba@v1 - with: - environment-file: chartlets.py/environment.yml - - - name: Run unit tests - shell: bash -l {0} - run: | - cd chartlets.py - pytest --cov=chartlets --cov-report=xml + python-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + defaults: + run: + working-directory: chartlets.py - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - directory: chartlets.py/ - flags: backend - verbose: true - token: ${{ secrets.CODECOV_TOKEN }} + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev,demo] + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Run unit tests + shell: bash -l {0} + run: | + pytest --cov=chartlets --cov-report=xml + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + directory: chartlets.py/ + flags: backend + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/frontend-ci.yml b/.github/workflows/frontend-ci.yml index 1d46c376..7bac187d 100644 --- a/.github/workflows/frontend-ci.yml +++ b/.github/workflows/frontend-ci.yml @@ -10,58 +10,63 @@ on: paths: - chartlets.js/** -jobs: - frontend: - runs-on: ubuntu-latest - steps: - - name: git-checkout chartlets - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '18.x' - - - name: Install common dependencies - run: | - cd chartlets.js - npm install - - - name: Lib lint - run: | - cd chartlets.js/packages/lib - npm run lint - - - name: Lib tests - run: | - cd chartlets.js/packages/lib - npm run test - - - name: Lib coverage - run: | - cd chartlets.js/packages/lib - npm run coverage - - - name: Upload coverage reports for lib to Codecov - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - directory: chartlets.js/packages/lib/coverage/ - flags: frontend - verbose: true - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Lib build - run: | - cd chartlets.js/packages/lib - npm run build - - - name: Demo lint - run: | - cd chartlets.js/packages/demo - npm run lint - - - name: Demo build - run: | - cd chartlets.js/packages/demo - npm run build +jobs: + npm-tests-lib: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16.x, 18.x, 20.x] + # See supported Node.js release schedule at + # https://nodejs.org/en/about/releases/ + defaults: + run: + working-directory: chartlets.js/packages/lib + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: chartlets.js/package-lock.json + + - run: npm ci + - run: npm run lint + - run: npm run test + + - run: npm run coverage + - name: Upload coverage reports for lib to Codecov + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + directory: coverage/ + flags: frontend + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} + + - run: npm run build + + npm-tests-demo: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16.x, 18.x, 20.x] + # See supported Node.js release schedule at + # https://nodejs.org/en/about/releases/ + defaults: + run: + working-directory: chartlets.js/packages/demo + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: chartlets.js/package-lock.json + + - run: npm ci + - run: npm run lint + - run: npm run build diff --git a/.github/workflows/publish-backend.yml b/.github/workflows/publish-backend.yml index 4877d38d..f1491114 100644 --- a/.github/workflows/publish-backend.yml +++ b/.github/workflows/publish-backend.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13"] defaults: run: working-directory: chartlets.py