CI/CD Build Tests #795
This file contains hidden or 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 Build Tests | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| types: [published] | |
| schedule: | |
| - cron: '30 3 * * 1,6' | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node: ['22', '24'] | |
| name: ubuntu-latest - Node ${{ matrix.node }} Test | |
| services: | |
| mysql: | |
| image: mysql:8.4 | |
| env: | |
| MYSQL_ROOT_PASSWORD: testpass | |
| MYSQL_DATABASE: testdb | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| mariadb: | |
| image: mariadb:11.4 | |
| env: | |
| MYSQL_ROOT_PASSWORD: testpass | |
| MYSQL_DATABASE: testdb | |
| ports: | |
| - 3307:3306 | |
| options: >- | |
| --health-cmd="healthcheck.sh --connect --innodb_initialized" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_PASSWORD: testpass | |
| POSTGRES_DB: testdb | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| name: Set up Node (NPM Cache) | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| if: hashFiles('package-lock.json') != '' | |
| - uses: actions/setup-node@v6 | |
| name: Set up Node (Yarn Cache) | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: yarn | |
| cache-dependency-path: yarn.lock | |
| if: hashFiles('yarn.lock') != '' | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python Dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| - name: Install Yarn | |
| run: npm install -g yarn | |
| - name: Install Dependencies | |
| run: yarn | |
| - name: Execute Unit Tests | |
| run: yarn test | |
| env: | |
| MYSQL_HOST: 127.0.0.1 | |
| MYSQL_USER: root | |
| MYSQL_PASSWORD: testpass | |
| MYSQL_DATABASE: testdb | |
| MARIADB_HOST: 127.0.0.1 | |
| MARIADB_PORT: '3307' | |
| MARIADB_USER: root | |
| MARIADB_PASSWORD: testpass | |
| MARIADB_DATABASE: testdb | |
| PGSQL_HOST: 127.0.0.1 | |
| PGSQL_USER: postgres | |
| PGSQL_PASSWORD: testpass | |
| PGSQL_DATABASE: testdb | |
| SQL_TABLE: ubuntu-${{ matrix.node }}-${{ github.sha }}-${{ github.event_name }} | |
| build-other: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest] | |
| node: ['22', '24'] | |
| name: ${{ matrix.os }} - Node ${{ matrix.node }} Test | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| name: Set up Node (NPM Cache) | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| if: hashFiles('package-lock.json') != '' | |
| - uses: actions/setup-node@v6 | |
| name: Set up Node (Yarn Cache) | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: yarn | |
| cache-dependency-path: yarn.lock | |
| if: hashFiles('yarn.lock') != '' | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python Dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| - name: Install Yarn | |
| run: npm install -g yarn | |
| - name: Install Dependencies | |
| run: yarn | |
| - name: Execute Unit Tests | |
| run: yarn test | |
| env: | |
| SQL_TABLE: ${{ matrix.os }}-${{ matrix.node }}-${{ github.sha }}-${{ github.event_name }} | |
| publish: | |
| needs: [build-linux, build-other] | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.22.1' # Pin to avoid 22.22.2 npm self-upgrade bug (nodejs/node#62425) | |
| - name: Update npm for OIDC support | |
| run: npm install -g npm@latest | |
| - name: Install Yarn | |
| run: npm install -g yarn | |
| - name: Install Dependencies | |
| run: yarn | |
| - name: Publish to NPM | |
| run: npm publish --access public --provenance |