Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
build-and-release:
runs-on: ubuntu-latest

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

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build binaries
env:
VERSION: ${{ github.ref_name }}
COMMIT: ${{ github.sha }}
run: |
set -euo pipefail
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
mkdir -p dist

MOD_PATH="$(awk '/^module /{print $2}' go.mod)"
MAIN_PKG="./cmd"

LDFLAGS="-s -w \
-X ${MOD_PATH}/internal/version.Version=${VERSION} \
-X ${MOD_PATH}/internal/version.Commit=${COMMIT} \
-X ${MOD_PATH}/internal/version.Date=${DATE}"

GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "$LDFLAGS" -o "dist/city2tabula_${VERSION}_linux_amd64" "$MAIN_PKG"
GOOS=windows GOARCH=amd64 go build -trimpath -ldflags "$LDFLAGS" -o "dist/city2tabula_${VERSION}_windows_amd64.exe" "$MAIN_PKG"
GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags "$LDFLAGS" -o "dist/city2tabula_${VERSION}_darwin_amd64" "$MAIN_PKG"
GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags "$LDFLAGS" -o "dist/city2tabula_${VERSION}_darwin_arm64" "$MAIN_PKG"

- name: Upload assets to GitHub release
uses: softprops/action-gh-release@v2
with:
files: dist/*
19 changes: 14 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package main
import (
"flag"
"fmt"
"os"
"sync"
"time"

"City2TABULA/internal/config"
"City2TABULA/internal/db"
"City2TABULA/internal/process"
"City2TABULA/internal/utils"
"github.com/THD-Spatial/City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/db"
"github.com/THD-Spatial/City2TABULA/internal/process"
"github.com/THD-Spatial/City2TABULA/internal/utils"
"github.com/THD-Spatial/City2TABULA/internal/version"

"github.com/jackc/pgx/v5/pgxpool"
)
Expand All @@ -21,9 +23,16 @@ func main() {
resetCityDB := flag.Bool("reset-citydb", false, "Reset only CityDB infrastructure (drop CityDB schemas, recreate them, and re-import CityDB data)")
resetC2T := flag.Bool("reset-city2tabula", false, "Reset only City2TABULA schemas (preserve CityDB)")
extractFeat := flag.Bool("extract-features", false, "Run the feature extraction pipeline")

showVersion := flag.Bool("version", false, "print version and exit")
showV := flag.Bool("v", false, "print version and exit (shorthand)")
flag.Parse()

// Display current version
if *showV || *showVersion {
fmt.Printf("%s (commit %s, built %s)\n", version.Version, version.Commit, version.Date)
os.Exit(0)
}

// Start timing
startTime := time.Now()
defer func() {
Expand Down
11 changes: 3 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module City2TABULA
module github.com/THD-Spatial/City2TABULA

go 1.24
go 1.25

require (
github.com/joho/godotenv v1.5.1
Expand All @@ -10,19 +10,14 @@ require (
require (
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.7.5
github.com/stretchr/testify v1.10.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/stretchr/testify v1.10.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/text v0.24.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
9 changes: 0 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -14,16 +13,10 @@ github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand All @@ -36,8 +29,6 @@ golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 2 additions & 2 deletions internal/db/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"time"

"City2TABULA/internal/config"
"City2TABULA/internal/utils"
"github.com/THD-Spatial/City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/utils"

"github.com/jackc/pgx/v5/pgxpool"
_ "github.com/lib/pq"
Expand Down
9 changes: 5 additions & 4 deletions internal/db/setup.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package db

import (
"City2TABULA/internal/config"
"City2TABULA/internal/importer"
"City2TABULA/internal/process"
"City2TABULA/internal/utils"
"context"
"fmt"
"os"
"sync"

"github.com/THD-Spatial/City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/importer"
"github.com/THD-Spatial/City2TABULA/internal/process"
"github.com/THD-Spatial/City2TABULA/internal/utils"

"github.com/jackc/pgx/v5/pgxpool"
)

Expand Down
5 changes: 3 additions & 2 deletions internal/importer/citydb.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package importer

import (
"City2TABULA/internal/config"
"City2TABULA/internal/utils"
"fmt"
"os"
"os/exec"
"path"

"github.com/THD-Spatial/City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/utils"

"github.com/jackc/pgx/v5/pgxpool"
)

Expand Down
7 changes: 4 additions & 3 deletions internal/importer/supplementary.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package importer

import (
"City2TABULA/internal/config"
"City2TABULA/internal/process"
"City2TABULA/internal/utils"
"fmt"
"os/exec"
"path/filepath"
"sync"

"github.com/THD-Spatial/City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/process"
"github.com/THD-Spatial/City2TABULA/internal/utils"

"github.com/jackc/pgx/v5/pgxpool"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/process/orchestrator.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package process

import (
"City2TABULA/internal/config"
"fmt"
"path/filepath"

"github.com/THD-Spatial/City2TABULA/internal/config"
)

// PipelineType represents different types of pipeline operations
Expand Down
5 changes: 3 additions & 2 deletions internal/process/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"math/rand"
"os"

"City2TABULA/internal/config"
"City2TABULA/internal/utils"
"sort"
"strings"
"time"

"github.com/THD-Spatial/City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/utils"

"github.com/jackc/pgx/v5/pgxpool"
)

Expand Down
5 changes: 3 additions & 2 deletions internal/process/worker.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package process

import (
"City2TABULA/internal/config"
"City2TABULA/internal/utils"
"sync"

"github.com/THD-Spatial/City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/utils"

"github.com/jackc/pgx/v5/pgxpool"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/utils/citydb.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package utils

import (
"City2TABULA/internal/config"
"context"
"fmt"
"os"
"os/exec"
"strings"

"github.com/THD-Spatial/City2TABULA/internal/config"

"github.com/jackc/pgx/v5/pgxpool"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/utils/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

"City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/config"

"github.com/jackc/pgx/v5/pgxpool"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"time"

"City2TABULA/internal/config"
"github.com/THD-Spatial/City2TABULA/internal/config"
)

// LogLevel represents the logging level
Expand Down
7 changes: 7 additions & 0 deletions internal/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package version

var (
Version = "dev"
Commit = "none"
Date = "unknown"
)