diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..2bab141 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,58 @@ +name: Push Validation + +on: + push: + branches: [ main, develop ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + name: Validate Push + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + cache: true + + - name: Install sqlc + run: | + go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest + + - name: Generate sqlc code + run: | + sqlc generate --no-remote + env: + SERVICE_DB_USER: postgres + SERVICE_DB_PASSWORD: postgres + SERVICE_DB_HOST: localhost + SERVICE_DB_PORT: 5432 + SERVICE_DB_NAME: postgres + + - name: Download dependencies + run: go mod download + + - name: Verify build + run: go build -o build/dhamps-vdb main.go + + - name: Run tests + run: go test -v ./... + env: + SERVICE_DEBUG: true + SERVICE_HOST: localhost + SERVICE_PORT: 8888 + SERVICE_DBHOST: localhost + SERVICE_DBPORT: 5432 + SERVICE_DBUSER: postgres + SERVICE_DBPASSWORD: postgres + SERVICE_DBNAME: postgres + SERVICE_ADMINKEY: TestAdminKey123 + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..818b739 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,58 @@ +name: Test + +on: + pull_request: + branches: [ main, develop ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + cache: true + + - name: Install sqlc + run: | + go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest + + - name: Generate sqlc code + run: | + sqlc generate --no-remote + env: + SERVICE_DB_USER: postgres + SERVICE_DB_PASSWORD: postgres + SERVICE_DB_HOST: localhost + SERVICE_DB_PORT: 5432 + SERVICE_DB_NAME: postgres + + - name: Download dependencies + run: go mod download + + - name: Verify build + run: go build -o build/dhamps-vdb main.go + + - name: Run tests + run: go test -v ./... + env: + SERVICE_DEBUG: true + SERVICE_HOST: localhost + SERVICE_PORT: 8888 + SERVICE_DBHOST: localhost + SERVICE_DBPORT: 5432 + SERVICE_DBUSER: postgres + SERVICE_DBPASSWORD: postgres + SERVICE_DBNAME: postgres + SERVICE_ADMINKEY: TestAdminKey123 +