Skip to content

Commit

Permalink
docs: Add v1.19 release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Jul 6, 2023
1 parent 1fea9f7 commit bc37e81
Show file tree
Hide file tree
Showing 10 changed files with 557 additions and 18 deletions.
14 changes: 14 additions & 0 deletions docs/_static/customize.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
.wy-side-nav-search img {
padding: 5px 60px !important;
}

#banner {
text-align: center;
background: #2980b9;
border: 1px solid rgb(52, 49, 49);
color: #F0F0F4;
padding: 10px;
margin-bottom: 1.618em;
}

#banner > div > a {
color: #F0F0F4;
text-decoration: underline;
}
10 changes: 10 additions & 0 deletions docs/_templates/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "!breadcrumbs.html" %}

{% block breadcrumbs %}
{% if show_banner %}
<header id="banner">
<div><strong>Big news:</strong> we're working full-time on sqlc. Read more <a href="https://sqlc.dev/posts/2023/07/06/working-on-sqlc-full-time">here</a>.</div>
</header>
{% endif %}
{{ super() }}
{% endblock %}
3 changes: 2 additions & 1 deletion docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends "!layout.html" %}

{% block extrahead %}
<script defer data-domain="docs.sqlc.dev" src="https://plausible.io/js/plausible.js"></script>
{{ super() }}
{% endblock %}
{% endblock %}
8 changes: 6 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import sphinx_rtd_theme
Expand All @@ -22,7 +22,7 @@
author = 'Kyle Conroy'

# The full version, including alpha/beta/rc tags
release = '1.18.0'
release = '1.19.0'


# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -61,6 +61,10 @@
'logo_only': True,
}

html_context = {
'show_banner': 'SHOW_LAUNCH_BANNER' in os.environ,
}

def setup(app):
app.add_css_file('customize.css')

Expand Down
92 changes: 92 additions & 0 deletions docs/howto/ci-cd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Suggested CI/CD setup

If your project has more than a single developer, we suggest running `sqlc` as
part of your CI/CD pipeline. The two commands you'll want to run are `diff` and `vet`

`sqlc diff` ensures that code is up to date. New developers to a project may
forget to run `sqlc generate`. They also might edit generated code. `diff` will
catch both scenarios.

```diff
% sqlc-dev diff
--- a/postgresql/query.sql.go
+++ b/postgresql/query.sql.go
@@ -55,7 +55,7 @@

const listAuthors = `-- name: ListAuthors :many
SELECT id, name, bio FROM authors
-ORDER BY name
+ORDER BY bio
`
```

`sqlc vet` runs a set of lint checks against your SQL queries. These checks are
helpful in catching anti-patterns before they make it into production. Please
see the [vet](../reference/cli.html#vet) documentation for a complete guide on adding checks to your
project.

## General setup

Install `sqlc` using the [suggested instructions](../overview/install).

Create two steps in your pipelines, one for `sqlc diff`and one for `sqlc vet`.

## GitHub Actions

We provide the [setup-sqlc](https://github.com/marketplace/actions/setup-sqlc)
GitHub Action to install `sqlc`. The action uses the built-in
[tool-cache](https://github.com/actions/toolkit/blob/main/packages/tool-cache/README.md)
to speed up the installation process.

The following workflow runs `sqlc diff` on every push.

```yaml
name: sqlc
on: [push]
jobs:
diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: sqlc-dev/setup-sqlc@v3
with:
sqlc-version: '1.19.0'
- run: sqlc diff
```

We also encourage running [`sqlc vet`](../reference/cli.html#vet). To get the most value out of `vet`,
you'll want to set up a running database. See the [vet] documentation for a
complete guide on adding checks to your project.

```yaml
name: sqlc
on: [push]
jobs:
vet:
runs-on: ubuntu-latest
services:
postgres:
image: "postgres:15"
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
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
env:
PG_PORT: ${{ job.services.postgres.ports['5432'] }}

steps:
- uses: actions/checkout@v3
- uses: sqlc-dev/setup-sqlc@v3
with:
sqlc-version: '1.19.0'
# Connect and migrate your database here. This is an example which runs
# commands from a `schema.sql` file.
- run: psql -h localhost -U postgres -p $PG_PORT -d postgres -f schema.sql
env:
PGPASSWORD: postgres
- run: sqlc vet
```
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ code ever again.
howto/ddl.md
howto/structs.md

howto/ci-cd.md
howto/upload.md

.. toctree::
Expand Down
8 changes: 4 additions & 4 deletions docs/overview/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ docker run --rm -v "%cd%:/src" -w /src kjconroy/sqlc generate

## Downloads

Get pre-built binaries for *v1.18.0*:
Get pre-built binaries for *v1.19.0*:

- [Linux](https://github.com/kyleconroy/sqlc/releases/download/v1.18.0/sqlc_1.18.0_linux_amd64.tar.gz)
- [macOS](https://github.com/kyleconroy/sqlc/releases/download/v1.18.0/sqlc_1.18.0_darwin_amd64.zip)
- [Windows (MySQL only)](https://github.com/kyleconroy/sqlc/releases/download/v1.18.0/sqlc_1.18.0_windows_amd64.zip)
- [Linux](https://github.com/kyleconroy/sqlc/releases/download/v1.19.0/sqlc_1.19.0_linux_amd64.tar.gz)
- [macOS](https://github.com/kyleconroy/sqlc/releases/download/v1.19.0/sqlc_1.19.0_darwin_amd64.zip)
- [Windows (MySQL only)](https://github.com/kyleconroy/sqlc/releases/download/v1.19.0/sqlc_1.19.0_windows_amd64.zip)

See [downloads.sqlc.dev](https://downloads.sqlc.dev/) for older versions.

0 comments on commit bc37e81

Please sign in to comment.