give db init more time #7402
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 | |
| on: [push, pull_request] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| mix_test: | |
| name: mix test (OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}}) | |
| env: | |
| MIX_ENV: test | |
| PHX_CI: true | |
| strategy: | |
| matrix: | |
| include: | |
| - elixir: "1.15.8" | |
| otp: "25.3.2.21" | |
| - elixir: "1.18.4" | |
| otp: "27.3.4.13" | |
| - elixir: "1.20.4" | |
| otp: "29.0.5" | |
| lint: true | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1 | |
| with: | |
| elixir-version: ${{ matrix.elixir }} | |
| otp-version: ${{ matrix.otp }} | |
| - name: Restore deps and _build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} | |
| - name: Install dependencies | |
| run: mix deps.get --only test | |
| - name: Remove compiled application files | |
| run: mix clean | |
| - name: Compile & lint dependencies | |
| run: mix compile --warnings-as-errors | |
| if: ${{ matrix.lint }} | |
| - name: Run tests | |
| run: mix test | |
| if: ${{ !matrix.lint }} | |
| - name: Run tests & lint | |
| run: mix test --warnings-as-errors | |
| if: ${{ matrix.lint }} | |
| installer_test: | |
| name: installer test (OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}}) | |
| env: | |
| MIX_ENV: test | |
| PHX_CI: true | |
| strategy: | |
| matrix: | |
| include: | |
| - elixir: "1.18.4" | |
| otp: "27.3.4.3" | |
| - elixir: "1.20.4" | |
| otp: "29.0.5" | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1 | |
| with: | |
| elixir-version: ${{ matrix.elixir }} | |
| otp-version: ${{ matrix.otp }} | |
| - name: Restore deps and _build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} | |
| - name: Install installer dependencies | |
| run: mix deps.get | |
| working-directory: installer | |
| - name: Run installer unit tests | |
| run: mix test | |
| working-directory: installer | |
| - name: Install root dependencies | |
| run: mix deps.get --only test | |
| - name: Run mix_phx_new generator integration tests | |
| run: mix test --only mix_phx_new | |
| npm_test: | |
| name: npm test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Restore deps and _build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: deps-${{ runner.os }}-npm-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| deps-${{ runner.os }}-npm | |
| - name: Set up Node.js 24.x | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24.x | |
| - name: Restore npm cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install locked npm dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| docs: | |
| name: mix docs | |
| env: | |
| MIX_ENV: docs | |
| strategy: | |
| matrix: | |
| include: | |
| - elixir: "1.20.4" | |
| otp: "29.0.5" | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1 | |
| with: | |
| elixir-version: ${{ matrix.elixir }} | |
| otp-version: ${{ matrix.otp }} | |
| # the docs alias also builds the JavaScript documentation with npm | |
| - name: Set up Node.js 24.x | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24.x | |
| - name: Restore deps and _build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: docs-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| docs-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} | |
| - name: Restore npm cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install dependencies | |
| run: mix deps.get --only docs | |
| - name: Build the documentation | |
| run: mix docs --warnings-as-errors | |
| integration-test-elixir: | |
| name: integration test (OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}} | partition ${{matrix.partition}}) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| strategy: | |
| # Keep running the remaining partitions when one fails, otherwise a single | |
| # failing partition hides the results of all the others. | |
| fail-fast: false | |
| matrix: | |
| # Test files are split across Elixir instances via `mix test --partitions`. | |
| # Keep this list in sync with the `--partitions` count in the test step below. | |
| partition: [1, 2, 3] | |
| elixir: ["1.18.4", "1.20.4"] | |
| include: | |
| - elixir: "1.18.4" | |
| otp: "27.3.4.3" | |
| - elixir: "1.20.4" | |
| otp: "29.0.5" | |
| env: | |
| ELIXIR_ASSERT_TIMEOUT: 10000 | |
| PHX_CI: true | |
| MIX_TEST_PARTITION: ${{ matrix.partition }} | |
| # Set to half of the runner vCPU cores to compile deps/NIFs | |
| # concurrently across OS processes without CPU oversubscription. | |
| # See https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories | |
| # and https://elixir-lang.org/blog/2025/10/16/elixir-v1-19-0-released/ | |
| MIX_OS_DEPS_COMPILE_PARTITION_COUNT: 2 | |
| MAKEFLAGS: "-j2" | |
| services: | |
| postgres: | |
| image: postgres:18 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| # Probe over TCP (-h 127.0.0.1) rather than the Unix socket: initdb runs | |
| # a temporary server with `listen_addresses` empty, and a socket probe | |
| # reports ready against *that* server, before the real one is listening. | |
| options: >- | |
| --health-cmd "pg_isready -U postgres -h 127.0.0.1" | |
| --health-interval 2s | |
| --health-timeout 3s | |
| --health-retries 10 | |
| --health-start-period 30s | |
| mysql: | |
| image: mysql:26 | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | |
| # Things to be aware of: | |
| # | |
| # 1. Initializing the data directory on first boot takes 30s+ on a slow | |
| # runner, which overruns the retry budget below. Probes that fail | |
| # during --health-start-period do not consume that budget, and the | |
| # first successful probe ends the period early. | |
| # 2. The entrypoint starts a temporary server during initialization with | |
| # `port: 0` (Unix socket only). `mysqladmin ping -h localhost` uses | |
| # the socket, so it reports healthy against that temporary server -- | |
| # which is then shut down and restarted. Probing over TCP instead | |
| # only succeeds once the real server is listening on 3306. | |
| options: >- | |
| --health-cmd "mysqladmin ping -h 127.0.0.1 --protocol=TCP" | |
| --health-interval 2s | |
| --health-timeout 3s | |
| --health-retries 10 | |
| --health-start-period 60s | |
| mssql: | |
| image: mcr.microsoft.com/mssql/server:2019-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| SA_PASSWORD: some!Password | |
| ports: | |
| - 1433:1433 | |
| options: >- | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P \"$SA_PASSWORD\" -C -Q 'SELECT 1' 2>/dev/null || /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P \"$SA_PASSWORD\" -Q 'SELECT 1' 2>/dev/null" | |
| --health-interval 2s | |
| --health-timeout 3s | |
| --health-retries 25 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Mount installer/tmp on tmpfs | |
| run: | | |
| mkdir -p installer/tmp | |
| sudo mount -t tmpfs -o size=4G,uid=$(id -u),gid=$(id -g) tmpfs installer/tmp | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1 | |
| with: | |
| elixir-version: ${{ matrix.elixir }} | |
| otp-version: ${{ matrix.otp }} | |
| - name: Restore deps and _build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| integration_test/deps | |
| integration_test/_build | |
| key: integration-deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('integration_test/mix.lock') }} | |
| restore-keys: | | |
| integration-deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} | |
| - name: Fetch dependencies | |
| working-directory: integration_test | |
| run: mix deps.get | |
| - name: Compile dependencies | |
| working-directory: integration_test | |
| run: mix deps.compile | |
| env: | |
| MIX_ENV: test | |
| - name: Run integration tests | |
| working-directory: integration_test | |
| run: | | |
| mix test --include database --partitions 3 \ | |
| --formatter ExUnit.CLIFormatter \ | |
| --formatter Phoenix.Integration.SummaryFormatter |