From 0950020c04a99c5373b7565b8bc90b4e77eb40d8 Mon Sep 17 00:00:00 2001 From: Luis Lavena Date: Sat, 1 Feb 2025 16:37:50 +0100 Subject: [PATCH 1/3] Use latest Crystal 1.15 --- .changes/unreleased/internal-20250201-163846.yaml | 5 +++++ compose.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/internal-20250201-163846.yaml diff --git a/.changes/unreleased/internal-20250201-163846.yaml b/.changes/unreleased/internal-20250201-163846.yaml new file mode 100644 index 0000000..7aaa86e --- /dev/null +++ b/.changes/unreleased/internal-20250201-163846.yaml @@ -0,0 +1,5 @@ +kind: internal +body: Build against Crystal 1.15 +time: 2025-02-01T16:38:46.086665+01:00 +custom: + Issue: "" diff --git a/compose.yaml b/compose.yaml index 0e9d2b2..a6de919 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,6 @@ services: app: - image: ghcr.io/luislavena/hydrofoil-crystal:1.11 + image: ghcr.io/luislavena/hydrofoil-crystal:1.15 command: overmind start -f Procfile.dev working_dir: /app From b26dd54a7c17e122a2c701c97a72f56e947c80c9 Mon Sep 17 00:00:00 2001 From: Luis Lavena Date: Sat, 1 Feb 2025 16:46:47 +0100 Subject: [PATCH 2/3] Formats using latest Crystal --- src/drift/commands/command.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drift/commands/command.cr b/src/drift/commands/command.cr index 7db27c4..9389968 100644 --- a/src/drift/commands/command.cr +++ b/src/drift/commands/command.cr @@ -73,7 +73,7 @@ module Drift "#{minutes}m #{seconds}s" end - private def with_migrator + private def with_migrator(&) if uri = options.db_url DB.open(uri) do |db| yield Drift::Migrator.from_path(db, options.migrations_path) From b3b728bc946186dd5646a4a552b3ac53ec87dc7b Mon Sep 17 00:00:00 2001 From: Luis Lavena Date: Sat, 1 Feb 2025 16:47:32 +0100 Subject: [PATCH 3/3] Uses Ameba to lint codebase Solves misc warnings when linting other codebases that use Drift as library. --- .ameba.yml | 2 ++ .changes/unreleased/internal-20250201-163935.yaml | 5 +++++ .github/workflows/test.yml | 12 +++++++++++- shard.yml | 7 +++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .ameba.yml create mode 100644 .changes/unreleased/internal-20250201-163935.yaml diff --git a/.ameba.yml b/.ameba.yml new file mode 100644 index 0000000..68adffe --- /dev/null +++ b/.ameba.yml @@ -0,0 +1,2 @@ +Naming/BlockParameterName: + Enabled: false diff --git a/.changes/unreleased/internal-20250201-163935.yaml b/.changes/unreleased/internal-20250201-163935.yaml new file mode 100644 index 0000000..a98983b --- /dev/null +++ b/.changes/unreleased/internal-20250201-163935.yaml @@ -0,0 +1,5 @@ +kind: internal +body: Use Ameba to lint codebase +time: 2025-02-01T16:39:35.22518+01:00 +custom: + Issue: "" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62c4bb1..7bb551f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,10 +27,20 @@ jobs: - uses: crystal-lang/install-crystal@v1 - run: crystal tool format --check + lint: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: crystal-ameba/github-action@v0.12.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: crystal-lang/install-crystal@v1 - - run: shards install + - run: shards install --skip-executables --skip-postinstall - run: crystal spec diff --git a/shard.yml b/shard.yml index 2bf1532..bdeeab5 100644 --- a/shard.yml +++ b/shard.yml @@ -7,6 +7,9 @@ authors: targets: drift: main: src/cli.cr + # FIXME: workaround due lack of pre-compiled CLI version + ameba: + main: lib/ameba/src/cli.cr dependencies: db: github: crystal-lang/crystal-db @@ -14,3 +17,7 @@ dependencies: sqlite3: github: crystal-lang/crystal-sqlite3 version: ~> 0.21.0 +development_dependencies: + ameba: + github: crystal-ameba/ameba + version: ~> 1.6.4