Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,55 +1,21 @@
name: Autoformat & Linting

# Note: For pull requests, GitHub Actions automatically creates a merge commit
# between your branch and the target branch (usually main), then runs checks on
# that merged state. This ensures the code will be properly formatted after merge.
# If this check fails, you may need to merge main into your branch first.
name: Elixir formatting

on:
push:
branches: ['main']
paths-ignore:
- '**/README.md'
- 'integration-tests/**'
pull_request:
paths-ignore:
- '**/README.md'
- 'integration-tests/**'
paths:
- 'packages/electric-telemetry/**'
- 'packages/elixir-client/**'
- 'packages/sync-service/**'

permissions:
contents: read

jobs:
typescript_formatting:
name: TypeScript formatting and linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check Prettier formatting
run: pnpm run format:check

- name: Check ESLint (all packages)
run: pnpm run stylecheck-all

elixir_formatting:
elixir_check_formatting:
strategy:
matrix:
package: [sync-service, elixir-client, electric-telemetry]
name: Elixir formatting and linting
name: Check Elixir formatting and compilation issues
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -72,11 +38,11 @@ jobs:
uses: actions/cache/restore@v4
with:
path: packages/${{ matrix.package }}/deps
key: "${{ runner.os }}-${{ matrix.package }}-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/${{ matrix.package }}/mix.lock') }}"
key: "${{ runner.os }}-${{ matrix.package }}-deps-${{ env.MIX_ENV }}-${{ hashFiles(format('packages/{0}/mix.lock', matrix.package)) }}"
restore-keys: |
${{ runner.os }}-${{ matrix.package }}-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/${{ matrix.package }}/mix.lock') }}
${{ runner.os }}-${{ matrix.package }}-deps-${{ env.MIX_ENV }}-
${{ runner.os }}-${{ matrix.package }}-deps-
${{ runner.os }}-${{ matrix.package }}-deps-${{ env.MIX_ENV }}-${{ hashFiles(format('packages/{0}/mix.lock', matrix.package)) }}
${{ runner.os }}-${{ matrix.package }}-deps-${{ env.MIX_ENV }}
${{ runner.os }}-${{ matrix.package }}-deps

- name: Restore compiled code
uses: actions/cache/restore@v4
Expand All @@ -86,17 +52,17 @@ jobs:
!packages/${{ matrix.package }}/_build/*/lib/electric
!packages/${{ matrix.package }}/_build/*/lib/electric_client
!packages/${{ matrix.package }}/_build/*/lib/electric_telemetry
key: "${{ runner.os }}-${{ matrix.package }}-build-${{ env.MIX_ENV }}-${{ hashFiles('packages/${{ matrix.package }}/mix.lock') }}"
key: "${{ runner.os }}-${{ matrix.package }}-build-${{ env.MIX_ENV }}-${{ hashFiles(format('packages/{0}/mix.lock', matrix.package)) }}"
restore-keys: |
${{ runner.os }}-${{ matrix.package }}-build-${{ env.MIX_ENV }}-${{ hashFiles('packages/${{ matrix.package }}/mix.lock') }}
${{ runner.os }}-${{ matrix.package }}-build-${{ env.MIX_ENV }}-
${{ runner.os }}-${{ matrix.package }}-build-
${{ runner.os }}-${{ matrix.package }}-build-${{ env.MIX_ENV }}-${{ hashFiles(format('packages/{0}/mix.lock', matrix.package)) }}
${{ runner.os }}-${{ matrix.package }}-build-${{ env.MIX_ENV }}
${{ runner.os }}-${{ matrix.package }}-build

- name: Install dependencies
run: mix deps.get

- name: Check Elixir formatting
run: mix format --check-formatted

- name: Check Elixir compiles without warnings
- name: Check the package compiles without warnings
run: mix compile --force --all-warnings --warnings-as-errors
39 changes: 39 additions & 0 deletions .github/workflows/ts_check_formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: TS formatting

on:
pull_request:
paths-ignore:
- '**/README.md'
- 'integration-tests/**'
- 'packages/electric-telemetry/**'
- 'packages/elixir-client/**'
- 'packages/sync-service/**'

permissions:
contents: read

jobs:
ts_check_formatting:
name: Check formatting of TS packages, examples and website
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check Prettier formatting
run: pnpm run format:check

- name: Check ESLint (all packages)
run: pnpm run stylecheck-all
11 changes: 0 additions & 11 deletions packages/elixir-client/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ defmodule Electric.Client.MixProject do
package: package(),
source_url: "#{@github_repo}/tree/main/packages/elixir-client",
homepage_url: "https://electric-sql.com",
# This will go away after we upgrade Elixir to 1.19, which expects the public `cli/0`
# function to be defined instead.
preferred_cli_env: [
dialyzer: :test,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.cobertura": :test,
"coveralls.lcov": :test
],
test_coverage: [
tool: ExCoveralls,
ignore_modules: [
Expand Down
11 changes: 0 additions & 11 deletions packages/sync-service/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ defmodule Electric.MixProject do
start_permanent: Mix.env() == :prod,
deps: deps(),
aliases: aliases(),
# This will go away after we upgrade Elixir to 1.19, which expects the public `cli/0`
# function to be defined instead.
preferred_cli_env: [
dialyzer: :test,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.cobertura": :test,
"coveralls.lcov": :test
],
releases: [
electric: [
applications: @telemetry_applications_in_release,
Expand Down