diff --git a/.github/workflows/annotate.yml b/.github/workflows/annotate.yml new file mode 100644 index 00000000000..96242254f1c --- /dev/null +++ b/.github/workflows/annotate.yml @@ -0,0 +1,58 @@ +name: Make sure annotate is up to date +on: + push: + branches: + - 'main' + pull_request: + types: [opened, synchronize, reopened] +jobs: + test-annotations: + name: test annotations + runs-on: ubuntu-latest + services: + postgres: + image: postgres:14-alpine + ports: + - '5432:5432' + env: + POSTGRES_DB: lago + POSTGRES_USER: lago + POSTGRES_PASSWORD: lago + env: + RAILS_ENV: test + DATABASE_URL: 'postgres://lago:lago@localhost:5432/lago' + LAGO_REDIS_CACHE_URL: 'redis://localhost:6379' + RAILS_MASTER_KEY: ${{ secrets.RAILS_TEST_KEY }} + SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} + LAGO_API_URL: https://api.lago.dev + LAGO_PDF_URL: https://pdf.lago.dev + SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }} + LAGO_FROM_EMAIL: noreply@getlago.com + LAGO_CLICKHOUSE_ENABLED: true + LAGO_CLICKHOUSE_MIGRATIONS_ENABLED: true + LAGO_CLICKHOUSE_HOST: localhost + LAGO_CLICKHOUSE_DATABASE: default + LAGO_CLICKHOUSE_USERNAME: '' + LAGO_CLICKHOUSE_PASSWORD: '' + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Ruby and gems + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3.4' + bundler-cache: true + - name: Start Clickhouse database + run: | + docker run -d --rm -p 8123:8123 -p 9000:9000 --ulimit nofile=262144:262144 -v ./clickhouse-s3:/var/lib/clickhouse-s3 -v ./ci/clickhouse/config.xml:/etc/clickhouse-server/config.d/config.xml clickhouse/clickhouse-server + shell: bash + - name: Generate RSA keys + run: ./scripts/generate.rsa.sh + - name: Set up Postgres database schema + run: bin/rails db:schema:load:primary + - name: Set up Clickhouse database schema + run: bin/rails db:migrate:clickhouse + - name: run annotate --frozen + run: bundle exec annotate --frozen + env: + RAILS_ENV: development diff --git a/.github/workflows/migrations-test.yml b/.github/workflows/migrations-test.yml index 1c547f4cfd4..ddc17d52b9d 100644 --- a/.github/workflows/migrations-test.yml +++ b/.github/workflows/migrations-test.yml @@ -2,7 +2,7 @@ name: Run rails migrations on: push: branches: - - "main" + - 'main' pull_request: types: [opened, synchronize, reopened] jobs: @@ -13,14 +13,14 @@ jobs: postgres: image: postgres:14-alpine ports: - - "5432:5432" + - '5432:5432' env: POSTGRES_DB: lago POSTGRES_USER: lago POSTGRES_PASSWORD: lago env: RAILS_ENV: test - DATABASE_URL: "postgres://lago:lago@localhost:5432/lago" + DATABASE_URL: 'postgres://lago:lago@localhost:5432/lago' RAILS_MASTER_KEY: ${{ secrets.RAILS_TEST_KEY }} SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} ENCRYPTION_PRIMARY_KEY: 5I9mjfzry2P787x4S5ZuDdJwXNgYEwqo @@ -34,8 +34,8 @@ jobs: LAGO_CLICKHOUSE_MIGRATIONS_ENABLED: true LAGO_CLICKHOUSE_HOST: localhost LAGO_CLICKHOUSE_DATABASE: default - LAGO_CLICKHOUSE_USERNAME: "" - LAGO_CLICKHOUSE_PASSWORD: "" + LAGO_CLICKHOUSE_USERNAME: '' + LAGO_CLICKHOUSE_PASSWORD: '' LAGO_DISABLE_SCHEMA_DUMP: true steps: - name: Checkout code @@ -43,7 +43,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3.4" + ruby-version: '3.3.4' bundler-cache: true - name: Start Clickhouse database run: | diff --git a/app/models/customer.rb b/app/models/customer.rb index 5a062b09264..b841f7241e6 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -182,7 +182,7 @@ def ensure_slug # deleted_at :datetime # document_locale :string # email :string -# finalize_zero_amount_invoice :integer default(0), not null +# finalize_zero_amount_invoice :integer default("inherit"), not null # invoice_grace_period :integer # legal_name :string # legal_number :string diff --git a/app/models/organization.rb b/app/models/organization.rb index 969a5496299..54b8acf5026 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -158,7 +158,7 @@ def validate_email_settings # email :string # email_settings :string default([]), not null, is an Array # eu_tax_management :boolean default(FALSE) -# finalize_zero_amount_invoice :boolean default(FALSE), not null +# finalize_zero_amount_invoice :boolean default(TRUE), not null # invoice_footer :text # invoice_grace_period :integer default(0), not null # legal_name :string