diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 17e4c20fe..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,50 +0,0 @@ -on: - push: -jobs: - amber-spec: - - runs-on: ubuntu-latest - - container: - image: crystallang/crystal - - services: - redis: - image: redis - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 6379:6379 - postgres: - image: postgres - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DB: test_app - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - steps: - - name: Update & install dependencies - run: apt update && apt install -y libpq-dev libsqlite3-dev libreadline-dev - - - name: Download source - uses: actions/checkout@v3 - - - name: Install shards - run: shards install - - - name: Run main tests - run: bin/amber_spec - env: - DATABASE_URL: "postgres://postgres:password@postgres:5432/test_app" - REDIS_URL: "redis://redis:6379" - AMBER_ENV: test diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml new file mode 100644 index 000000000..aa60866d6 --- /dev/null +++ b/.github/workflows/docker-ci.yml @@ -0,0 +1,26 @@ +name: Docker CI + +on: + push: + +jobs: + docker: + timeout-minutes: 10 + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Start containers + run: docker-compose up -d redis postgres + + - name: Build image + run: docker-compose build + + - name: Run tests + run: docker-compose run spec + + - name: Stop containers + if: always() + run: docker-compose down diff --git a/Dockerfile b/Dockerfile index a49391c59..f9509173f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,9 @@ FROM crystallang/crystal:latest # Install Dependencies ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update -qq && apt-get install -y --no-install-recommends libpq-dev libsqlite3-dev libmysqlclient-dev libreadline-dev git curl vim netcat +RUN apt-get update -qq && apt-get install -y libpq-dev libsqlite3-dev libmysqlclient-dev libreadline-dev curl vim -# Install Node +# Install nodejs RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - RUN apt-get install -y nodejs diff --git a/docker-compose.yml b/docker-compose.yml index 6b4b2b2d5..5e0ff292c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: command: redis-server ports: - 6379:6379 + spec: build: . command: bin/amber_spec diff --git a/spec/amber/controller/render_spec.cr b/spec/amber/controller/render_spec.cr index 02e81c355..567c7624d 100644 --- a/spec/amber/controller/render_spec.cr +++ b/spec/amber/controller/render_spec.cr @@ -29,11 +29,11 @@ module Amber::Controller RenderController.new(context).render_with_layout.should eq layout_with_template end - it "renders a form with a csrf tag" do - result = RenderController.new(context).render_with_csrf - result.should contain "