Skip to content

Commit

Permalink
Move module to maragu.dev/migrate (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
markuswustenberg committed Sep 10, 2024
1 parent d7af95b commit 1b316e9
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 24 deletions.
35 changes: 25 additions & 10 deletions .github/workflows/go.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
name: Go
name: CI

on:
push:
branches: [ main ]
branches:
- main
pull_request:
branches: [ main ]
branches:
- main

jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
test:
name: Test
runs-on: ubuntu-latest

strategy:
matrix:
go: ["1.16", "1.17", "1.18", "1.19"]
postgres: ["12", "13", "14", "15"]
go: ["1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.22", "1.23"]
postgres: ["12", "13", "14", "15", "16"]

services:
postgres:
image: postgres:${{ matrix.postgres }}
Expand All @@ -41,12 +48,13 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
check-latest: true
Expand All @@ -65,11 +73,18 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true

- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v4
with:
version: latest
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Maragu ApS
Copyright (c) Maragu ApS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
.PHONY: cover lint test

.PHONY: cover
cover:
go tool cover -html=cover.out

.PHONY: lint
lint:
golangci-lint run

test:
go test -coverprofile=cover.out ./...
.PHONY: test
test: test-up
go test -coverprofile=cover.out -shuffle on -p 1 ./...

.PHONY: test-down
test-down:
docker compose down

.PHONY: test-up
test-up:
docker compose up -d
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Migrate

[![GoDoc](https://godoc.org/github.com/maragudk/migrate?status.svg)](https://godoc.org/github.com/maragudk/migrate)
[![GoDoc](https://pkg.go.dev/badge/maragu.dev/migrate)](https://pkg.go.dev/maragu.dev/migrate)
[![Go](https://github.com/maragudk/migrate/actions/workflows/go.yml/badge.svg)](https://github.com/maragudk/migrate/actions/workflows/go.yml)

A simple database migration tool using an `sql.DB` connection and `fs.FS` for the migration source. It has no non-test dependencies.
Expand All @@ -16,7 +16,7 @@ Made in 🇩🇰 by [maragu](https://www.maragu.dk), maker of [online Go courses
## Usage

```shell
go get -u github.com/maragudk/migrate
go get maragu.dev/migrate
```

```go
Expand All @@ -28,7 +28,7 @@ import (
"os"

_ "github.com/jackc/pgx/v4/stdlib"
"github.com/maragudk/migrate"
"maragu.dev/migrate"
)

// migrations is a directory with sql files that look something like this:
Expand Down
7 changes: 3 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
version: '3.8'
services:
postgres:
image: postgres:14
image: postgres:16
environment:
POSTGRES_PASSWORD: 123
ports:
- 5432:5432
- "5432:5432"
maria:
image: mariadb:10
environment:
Expand All @@ -14,4 +13,4 @@ services:
MARIADB_PASSWORD: 123
MARIADB_DATABASE: maria
ports:
- 3306:3306
- "3306:3306"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/maragudk/migrate
module maragu.dev/migrate

go 1.16

Expand Down
2 changes: 1 addition & 1 deletion migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/matryer/is"
_ "github.com/mattn/go-sqlite3"

"github.com/maragudk/migrate"
"maragu.dev/migrate"
)

var testdata = os.DirFS("testdata")
Expand Down

0 comments on commit 1b316e9

Please sign in to comment.