Skip to content

Commit

Permalink
Merge pull request #1 from aereal/setup-ci
Browse files Browse the repository at this point in the history
Add CI
  • Loading branch information
aereal authored Nov 9, 2020
2 parents ee9e95d + a1fa4a9 commit a3702b7
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---

name: CI
on:
pull_request:
push:
branches:
- main
schedule:
-
cron: '0 1 * * *'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: lint
uses: reviewdog/action-golangci-lint@v1
test:
strategy:
matrix:
go_version:
- 1.14.x
- 1.15.x
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go_version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go_version }}
- name: test
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- uses: codecov/codecov-action@v1
if: matrix.os == 'ubuntu-latest' && matrix.go_version == '1.15.x'
release:
if: github.ref == 'refs/heads/main'
needs:
- test
- lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- run: |
npx semantic-release --debug \
--branches main \
--plugins @semantic-release/commit-analyzer \
--plugins @semantic-release/release-notes-generator \
--plugins @semantic-release/github
env:
GITHUB_TOKEN: ${{ github.token }}
68 changes: 68 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package timestreamdriver

import (
"context"
"database/sql/driver"
)

type Driver struct{}

func (d *Driver) Open(dsn string) (driver.Conn, error) {
connector, err := d.OpenConnector(dsn)
if err != nil {
return nil, err
}
return connector.Connect(context.Background())
}

func (d *Driver) OpenConnector(dsn string) (driver.Connector, error) {
return &Connector{}, nil
}

var _ interface {
driver.Driver
driver.DriverContext
} = &Driver{}

type Connector struct{}

func (c *Connector) Connect(ctx context.Context) (driver.Conn, error) {
return &Conn{}, nil
}

func (c *Connector) Driver() driver.Driver {
return &Driver{}
}

type Conn struct {
// TODO: Execer
// TODO: ExecerContext
// TODO: Pinger
// TODO: Queryer
// TODO: QueryerContext
// TODO: NamedValueChecker
// TODO: SessionResetter
// TODO: Validator
}

func (c *Conn) Begin() (driver.Tx, error) {
return &Tx{}, nil
}

func (c *Conn) Prepare(query string) (driver.Stmt, error) {
return nil, nil
}

func (c *Conn) Close() error {
return nil
}

type Tx struct{}

func (t *Tx) Commit() error {
return nil
}

func (t *Tx) Rollback() error {
return nil
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/aereal/go-aws-timestream-driver

go 1.15

0 comments on commit a3702b7

Please sign in to comment.