diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae63d4c..20b6866 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-latest continue-on-error: false steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - uses: crystal-lang/install-crystal@v1 with: - crystal: 1.4.1 + crystal: latest - name: Install shards run: shards install - name: Format @@ -27,35 +27,23 @@ jobs: strategy: fail-fast: false matrix: + os: + - ubuntu-latest + postgres_version: + - 16 crystal_version: - - 1.4.0 + - 1.10.0 - latest experimental: - false - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} - services: - postgres: - image: postgres:13-alpine - env: - POSTGRES_USER: lucky - POSTGRES_PASSWORD: developer - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: crystal-lang/install-crystal@v1 with: crystal: ${{matrix.crystal_version}} - name: Install shards - run: shards install - - name: Setup Database - run: crystal tasks.cr db.setup - env: - DATABASE_URL: postgres://lucky:developer@localhost:5432/authentic_test + run: shards install --skip-postinstall --skip-executables - name: Run tests run: crystal spec - env: - DATABASE_URL: postgres://lucky:developer@localhost:5432/authentic_test diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 07e232f..65be2ed 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,18 +8,18 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: persist-credentials: false - uses: crystal-lang/install-crystal@v1 with: crystal: latest - name: "Install shards" - run: shards install + run: shards install --skip-postinstall --skip-executables - name: "Generate docs" run: crystal docs - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs diff --git a/config.cr b/config.cr index 176cda3..dfeb098 100644 --- a/config.cr +++ b/config.cr @@ -1,19 +1,9 @@ -database = "authentic_test" - class AppDatabase < Avram::Database end +# The specs for this shard don't actually make DB queries AppDatabase.configure do |settings| - if ENV["DATABASE_URL"]? - settings.credentials = Avram::Credentials.parse(ENV["DATABASE_URL"]) - else - settings.credentials = Avram::Credentials.new( - database: database, - hostname: "db", - username: "lucky", - password: "developer" - ) - end + settings.credentials = Avram::Credentials.parse("postgres://fake:password@localhost:5432/not_used") end Avram.configure do |settings| diff --git a/shard.yml b/shard.yml index f083348..4fbe50b 100644 --- a/shard.yml +++ b/shard.yml @@ -4,7 +4,7 @@ version: 1.0.0 authors: - Paul Smith -crystal: ">= 1.6.0" +crystal: ">= 1.10.0" license: MIT @@ -17,9 +17,9 @@ dependencies: version: ">= 1.0.0" habitat: github: luckyframework/habitat - version: ~> 0.4.7 + version: ~> 0.4.9 development_dependencies: ameba: github: crystal-ameba/ameba - version: ~> 1.1.0 + version: ~> 1.5.0 diff --git a/spec/action_helpers_spec.cr b/spec/action_helpers_spec.cr index b0a4bc9..e5a8195 100644 --- a/spec/action_helpers_spec.cr +++ b/spec/action_helpers_spec.cr @@ -35,7 +35,7 @@ describe Authentic::ActionHelpers do action.sign_in(FakeAuthenticatable.new(id: 123)) action.current_user.should be_a FakeAuthenticatable - action.current_user.not_nil!.id.should eq 123 + action.current_user.as(FakeAuthenticatable).id.should eq 123 end it "returns nil if user is not signed in?" do diff --git a/spec/authentic_spec.cr b/spec/authentic_spec.cr index e6f5936..fdbcf50 100644 --- a/spec/authentic_spec.cr +++ b/spec/authentic_spec.cr @@ -95,7 +95,7 @@ describe Authentic do Authentic.copy_and_encrypt from: password, to: encrypted_password - encrypted_password.value.not_nil!.size.should eq 60 + encrypted_password.value.as(String).size.should eq 60 end it "can create an encrypted password" do diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 3ef7f29..e0e1f68 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -2,7 +2,3 @@ require "spec" require "../src/authentic" require "../config" require "./support/**" - -Spec.before_each do - AppDatabase.truncate -end