Add initial README.md #559
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push] | |
jobs: | |
test: | |
name: test (postgres ${{ matrix.pgVersion }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
pgVersion: ['14.8', '15.3'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Run tests | |
run: go test ./... | |
env: | |
POSTGRES_VERSION: ${{ matrix.pgVersion }} | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Require: The version of golangci-lint to use. | |
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. | |
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. | |
version: v1.53 | |
# Optional: golangci-lint command line arguments. | |
# | |
# Note: By default, the `.golangci.yml` file should be at the root of the repository. | |
# The location of the configuration file can be changed by using `--config=` | |
args: --timeout=30m --out-format=colored-line-number --config=.golangci.yml | |
- name: Ensure JSON examples are formatted | |
run: | | |
for file in ./examples/*.json; do | |
if ! diff <(cat $file | jq) <(cat $file); then | |
echo "$file is not formatted: run 'cat $file | jq' to fix"; | |
exit 1; | |
fi | |
done | |
examples: | |
name: examples (postgres ${{ matrix.pgVersion }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pgVersion: ['14.8', '15.3'] | |
services: | |
postgres: | |
image: postgres:${{ matrix.pgVersion }} | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Run example migrations | |
run: | | |
go run . init | |
for file in ./examples/*.json; do | |
if [ -f "$file" ]; then | |
go run . start --complete $file; | |
fi | |
done | |
build: | |
runs-on: ubuntu-latest | |
needs: [test, lint, examples] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Build pg-roll (Linux amd64) | |
run: GOOS=linux GOARCH=amd64 go build -o pg-roll.linux.amd64 | |
- name: Build pg-roll (Linux arm64) | |
run: GOOS=linux GOARCH=arm64 go build -o pg-roll.linux.arm64 | |
- name: Build pg-roll (MacOS amd64) | |
run: GOOS=darwin GOARCH=amd64 go build -o pg-roll.macos.amd64 | |
- name: Build pg-roll (MacOS arm64) | |
run: GOOS=darwin GOARCH=arm64 go build -o pg-roll.macos.arm64 | |
- name: Build pg-roll (Windows) | |
run: GOOS=windows GOARCH=amd64 go build -o pg-roll.win.amd64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pg-roll.linux.amd64 | |
path: pg-roll.linux.amd64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pg-roll.linux.arm64 | |
path: pg-roll.linux.arm64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pg-roll.macos.amd64 | |
path: pg-roll.macos.amd64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pg-roll.macos.arm64 | |
path: pg-roll.macos.arm64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pg-roll.win.amd64 | |
path: pg-roll.win.amd64 | |
release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
artifacts/pg-roll.linux.amd64/pg-roll.linux.amd64 | |
artifacts/pg-roll.linux.arm64/pg-roll.linux.arm64 | |
artifacts/pg-roll.macos.amd64/pg-roll.macos.amd64 | |
artifacts/pg-roll.macos.arm64/pg-roll.macos.arm64 | |
artifacts/pg-roll.win.amd64/pg-roll.win.amd64 |