add ci for npm dist (#14) #32
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: CI/CD | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements.txt | |
- name: Run tests | |
run: python -m unittest discover test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
create-linux-package: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements.txt | |
- name: Install npm dependencies | |
run: | | |
if [ -f package-lock.json ]; then | |
npm ci --verbose | |
else | |
npm install --verbose | |
fi | |
- name: Rebuild sqlite3 | |
run: | | |
npm run rebuild --verbose | |
- name: Build Linux package | |
run: | | |
npm run dump --verbose | |
npm run dist --verbose | |
- name: Upload Linux package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-package | |
path: dist/linux-unpacked/* | |
create-windows-package: | |
runs-on: windows-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements.txt | |
- name: Install npm dependencies | |
run: | | |
if (Test-Path package-lock.json) { | |
npm ci --verbose | |
} else { | |
npm install --verbose | |
} | |
- name: Rebuild sqlite3 | |
run: | | |
npm run rebuild --verbose | |
- name: Build Windows package | |
run: | | |
npm run dump --verbose | |
npm run dist --verbose | |
- name: Upload Windows package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-package | |
path: dist/win-unpacked/* |