123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- name: CI
- on:
- push:
- branches:
- - renovate/**
- pull_request:
- merge_group:
- workflow_dispatch:
- # workflow_ref includes the branch ref & the file name
- # which means a unique run per branch for push & pull_request
- # pull_request_target would use the ref of the target branch, which would not be suitable
- concurrency:
- group: '${{ github.workflow_ref }}'
- cancel-in-progress: true
- jobs:
- install-and-build:
- # We already run the CI on "push" for renovate branches
- if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
- strategy:
- fail-fast: false
- matrix:
- node-version: [18, 20]
- name: Upload install and build artifact (Node ${{ matrix.node-version }})
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: ${{ matrix.node-version }}
- cache: yarn
- - name: Install dependencies
- run: yarn install --immutable
- - name: Build sequelize
- run: yarn build
- - name: Reset NX cache
- run: yarn nx reset
- - name: Compress artifact
- run: tar -cf install-build-node-${{ matrix.node-version }}.tar ./packages/*/lib ./node_modules ./packages/*/node_modules
- - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
- with:
- name: install-build-artifact-node-${{ matrix.node-version }}
- path: install-build-node-${{ matrix.node-version }}.tar
- retention-days: 1
- lint:
- name: Lint code
- runs-on: ubuntu-latest
- needs: install-and-build
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: 20.19.4
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-20
- - name: Extract artifact
- run: tar -xf install-build-node-20.tar
- - run: yarn test:format
- unit-test:
- strategy:
- fail-fast: false
- matrix:
- node-version: [18, 20]
- name: Unit test all dialects (Node ${{ matrix.node-version }})
- runs-on: ubuntu-latest
- needs: lint
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: ${{ matrix.node-version }}
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-${{ matrix.node-version }}
- - name: Extract artifact
- run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- - name: ESM / CJS export equivalence
- run: yarn test-unit-esm
- - name: Unit tests (validator.js)
- run: yarn lerna run test-unit --scope=@sequelize/validator.js
- - name: Unit tests (cli)
- run: yarn lerna run test-unit --scope=@sequelize/cli
- - name: Unit tests (utils)
- run: yarn lerna run test-unit --scope=@sequelize/utils
- - name: Unit tests (core - mariadb)
- run: yarn lerna run test-unit-mariadb --scope=@sequelize/core
- - name: Unit tests (mariadb package)
- run: yarn lerna run test-unit --scope=@sequelize/mariadb
- - name: Unit tests (core - mysql)
- run: yarn lerna run test-unit-mysql --scope=@sequelize/core
- - name: Unit tests (mysql package)
- run: yarn lerna run test-unit --scope=@sequelize/mysql
- - name: Unit tests (core - postgres)
- run: yarn lerna run test-unit-postgres --scope=@sequelize/core
- - name: Unit tests (postgres package)
- run: yarn lerna run test-unit --scope=@sequelize/postgres
- - name: Unit tests (core - sqlite3)
- run: yarn lerna run test-unit-sqlite3 --scope=@sequelize/core
- - name: Unit tests (core - mssql)
- run: yarn lerna run test-unit-mssql --scope=@sequelize/core
- - name: Unit tests (mssql package)
- run: yarn lerna run test-unit --scope=@sequelize/mssql
- - name: Unit tests (core - db2)
- run: yarn lerna run test-unit-db2 --scope=@sequelize/core
- - name: Unit tests (core - ibmi)
- run: yarn lerna run test-unit-ibmi --scope=@sequelize/core
- - name: Unit tests (core - snowflake)
- run: yarn lerna run test-unit-snowflake --scope=@sequelize/core
- - name: SQLite SSCCE
- run: yarn sscce-sqlite3
- test-win:
- strategy:
- fail-fast: false
- matrix:
- node-version: [18, 20]
- name: Build and test on Windows (Node ${{ matrix.node-version }})
- runs-on: windows-latest
- needs: lint # don't bother running if lint tests fail
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: ${{ matrix.node-version }}
- cache: yarn
- - name: Install dependencies
- run: yarn install --immutable
- - name: Build sequelize
- run: yarn build
- - name: Unit tests
- run: yarn lerna run test-unit
- - name: SSCCE
- run: yarn sscce-sqlite3
- - name: Integration tests (sqlite3)
- run: yarn lerna run test-integration-sqlite3 --scope=@sequelize/core
- docs:
- name: Generate TypeDoc
- runs-on: ubuntu-latest
- needs: lint
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: 20.19.4
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-20
- - name: Extract artifact
- run: tar -xf install-build-node-20.tar
- - run: yarn docs
- test-typings:
- strategy:
- fail-fast: false
- matrix:
- ts-version: ['5.5', '5.6', '5.7', '5.8']
- name: TS Typings (${{ matrix.ts-version }})
- runs-on: ubuntu-latest
- needs: lint
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: 20.19.4
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-20
- - name: Extract artifact
- run: tar -xf install-build-node-20.tar
- - name: Install TypeScript
- run: yarn add typescript@~${{ matrix.ts-version }}
- - name: Typing Tests
- run: yarn test-typings
- test-sqlite3:
- strategy:
- fail-fast: false
- matrix:
- node-version: [18, 20]
- name: sqlite3 (Node ${{ matrix.node-version }})
- runs-on: ubuntu-latest
- needs: [unit-test, test-typings]
- env:
- DIALECT: sqlite3
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: ${{ matrix.node-version }}
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-${{ matrix.node-version }}
- - name: Extract artifact
- run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- - name: Integration Tests
- run: yarn lerna run test-integration --scope=@sequelize/core
- test-postgres:
- strategy:
- fail-fast: false
- matrix:
- node-version: [18, 20]
- postgres-version: [oldest, latest]
- minify-aliases: [true, false]
- native: [true, false]
- name: postgres ${{ matrix.postgres-version }}${{ matrix.native && ' (native)' || '' }} (Node ${{ matrix.node-version }})${{ matrix.minify-aliases && ' (minified aliases)' || '' }}
- runs-on: ubuntu-latest
- needs: [unit-test, test-typings]
- env:
- DIALECT: ${{ matrix.native && 'postgres-native' || 'postgres' }}
- SEQ_PG_MINIFY_ALIASES: ${{ matrix.minify-aliases && '1' || '' }}
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: ${{ matrix.node-version }}
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-${{ matrix.node-version }}
- - name: Extract artifact
- run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- - name: Install pg-native
- run: yarn workspace @sequelize/core add pg-native
- if: matrix.native
- - run: yarn start-postgres-${{ matrix.postgres-version }}
- - name: Integration Tests
- run: yarn lerna run test-integration --scope=@sequelize/core
- test-oldest-latest:
- strategy:
- fail-fast: false
- matrix:
- node-version: [18, 20]
- database-version: [oldest, latest]
- dialect: [mysql, mariadb, db2]
- name: ${{ matrix.dialect }} ${{ matrix.database-version }} (Node ${{ matrix.node-version }})
- runs-on: ubuntu-latest
- needs: [unit-test, test-typings]
- env:
- DIALECT: ${{ matrix.dialect }}
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: ${{ matrix.node-version }}
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-${{ matrix.node-version }}
- - name: Extract artifact
- run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- - run: yarn start-${{ matrix.dialect }}-${{ matrix.database-version }}
- - name: Integration Tests
- run: yarn lerna run test-integration --scope=@sequelize/core
- test-mssql-latest:
- strategy:
- fail-fast: false
- matrix:
- node-version: [18, 20]
- name: mssql latest (Node ${{ matrix.node-version }})
- runs-on: ubuntu-latest
- needs: [unit-test, test-typings]
- env:
- DIALECT: mssql
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: ${{ matrix.node-version }}
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-${{ matrix.node-version }}
- - name: Extract artifact
- run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- - run: yarn start-mssql-latest
- - name: Integration Tests
- run: yarn lerna run test-integration --scope=@sequelize/core
- # TODO: the following CI job is disabled due to mssql 2017 Docker image not working with ubuntu-22.04 or later. See https://github.com/sequelize/sequelize/pull/17772
- # test-mssql-oldest:
- # strategy:
- # fail-fast: false
- # matrix:
- # node-version: [18, 20]
- # name: mssql oldest (Node ${{ matrix.node-version }})
- # runs-on: ubuntu-20.04
- # needs: [unit-test, test-typings]
- # env:
- # DIALECT: mssql
- # steps:
- # - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- # - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
- # with:
- # node-version: ${{ matrix.node-version }}
- # cache: yarn
- # - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
- # with:
- # name: install-build-artifact-node-${{ matrix.node-version }}
- # - name: Extract artifact
- # run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- # - run: yarn start-mssql-oldest
- # - name: Integration Tests
- # run: yarn lerna run test-integration --scope=@sequelize/core
- release:
- name: Release
- runs-on: ubuntu-latest
- needs:
- # TODO: add test-mssql-oldest back here when it's uncommented
- [docs, test-sqlite3, test-postgres, test-oldest-latest, test-mssql-latest]
- if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
- env:
- NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
- steps:
- - name: Generate Sequelize Bot Token
- id: generate-token
- uses: actions/create-github-app-token@v1
- with:
- app-id: '${{ secrets.SEQUELIZE_BOT_APP_ID }}'
- private-key: '${{ secrets.SEQUELIZE_BOT_PRIVATE_KEY }}'
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- with:
- # Number of commits to fetch. 0 indicates all history for all branches and tags.
- # We need the entire history to generate the changelog properly
- fetch-depth: 0
- # The credentials used for checkout are persisted
- # Lerna will use the same credentials later for "git push".
- # This must be done using the Sequelize bot.
- token: '${{ steps.generate-token.outputs.token }}'
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: 20.19.4
- cache: yarn
- - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- with:
- name: install-build-artifact-node-20
- - name: Extract artifact
- run: tar -xf install-build-node-20.tar
- - name: Configure git
- run: |
- git config --global user.name "github-actions[bot]"
- git config --global user.email "bot@sequelize.org"
- - name: Set npm auth token
- run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
- - run: yarn publish-all
- env:
- GITHUB_TOKEN: '${{ steps.generate-token.outputs.token }}'
- GH_TOKEN: '${{ steps.generate-token.outputs.token }}'
- - id: sequelize
- uses: sdepold/github-action-get-latest-release@aa12fcb2943e8899cbcc29ff6f73409b32b48fa1 # master
- with:
- repository: sequelize/sequelize
- - name: Notify channels
- run: |
- curl -XPOST -u "sdepold:${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/sequelize/sequelize/dispatches --data '{"event_type":"Release notifier","client_payload":{"release-id": ${{ steps.sequelize.outputs.id }}}}'
- - name: Notify docs repo
- run: |
- curl -XPOST -u "sdepold:${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/sequelize/website/dispatches --data '{"event_type":"Build website"}'
|