diff --git a/.github/workflows/python-ci.yml b/.github/workflows/go-ci.yml similarity index 74% rename from .github/workflows/python-ci.yml rename to .github/workflows/go-ci.yml index bd29d52..791022f 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/go-ci.yml @@ -1,4 +1,4 @@ -name: Go CI +name: CI concurrency: ci-${{ github.ref }} @@ -6,7 +6,10 @@ on: push: branches: [develop] paths: - - "src/**" + - "**/*.go" + - go.mod + - go.sum + - .go-version workflow_dispatch: jobs: @@ -19,13 +22,23 @@ jobs: include: - { name: Linux, - python: "1.23", os: ubuntu-latest, } steps: - uses: actions/checkout@v4 - - name: tests - run: echo "TODO" + - name: Get swift version + id: get_lang_version + run: | + v=$(cat .go-version) + echo "go_version=$v" >> $GITHUB_OUTPUT + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ steps.get_lang_version.outputs.go_version }} + - name: Build + run: go build -v ./... + - name: Test + run: go test -v ./... # docs: # needs: [tests] diff --git a/.github/workflows/go-pr.yml b/.github/workflows/go-pr.yml new file mode 100644 index 0000000..9c55b7a --- /dev/null +++ b/.github/workflows/go-pr.yml @@ -0,0 +1,40 @@ +name: PR + +concurrency: pr-${{ github.ref }} + +on: + pull_request: + branches: [develop] + paths: + - "**/*.go" + - go.mod + - go.sum + - .go-version + +jobs: + tests: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - { + name: Linux, + os: ubuntu-latest, + } + steps: + - uses: actions/checkout@v4 + - name: Get swift version + id: get_lang_version + run: | + v=$(cat .go-version) + echo "go_version=$v" >> $GITHUB_OUTPUT + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ steps.get_lang_version.outputs.go_version }} + - name: Build + run: go build -v ./... + - name: Test + run: go test -v ./... diff --git a/.github/workflows/python-pr.yml b/.github/workflows/python-pr.yml deleted file mode 100644 index 0ca1f77..0000000 --- a/.github/workflows/python-pr.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: PR - -concurrency: pr-${{ github.ref }} - -on: - pull_request: - branches: [develop] - paths: - - "src/**" - - "tests/**" - - setup.cfg - - setup.py - - tox.ini - - "requirements/**" - - "docs/**" - -jobs: - tests: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - { - name: Linux, - python: "3.11", - os: ubuntu-latest, - tox: py311, - } - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: update-pip - run: | - pip install -U wheel - pip install -U setuptools - python -m pip install -U pip - - name: get-pip-cache-dir - id: pip-cache - run: echo "::set-output name=dir::$(pip cache dir)" - - name: cache-pip - uses: actions/cache@v4 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}|${{ hashFiles('requirements/*.txt') }} - - name: install-utils - run: pip install tox - - name: tests - run: tox -e ${{ matrix.tox }} diff --git a/.github/workflows/python-update-reqs.yml b/.github/workflows/python-update-reqs.yml deleted file mode 100644 index 0a272b2..0000000 --- a/.github/workflows/python-update-reqs.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Update Requirements - -on: - workflow_dispatch: - repository_dispatch: - types: - - model-core-published - - api-core-published - - catalog-objects-published - - db-published - schedule: - - cron: "0 1 * * 1" - push: - branches: - - develop - paths: - - "requirements/*.in" - - setup.py - -jobs: - update-reqs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: update-reqs - run: | - pip install -U wheel setuptools pip-tools - git config --global user.email "ci@sweetrpg.com" - git config --global user.name "SweetRPG Requirement Updater" - git checkout ${{ github.head_ref || github.ref_name }} - scripts/update-requirements.sh - git add requirements/*.txt - git commit -m "Update requirements" - git push origin diff --git a/cmd/catalog-api/main.go b/cmd/catalog-api/main.go index 7bbb10c..f9f457e 100644 --- a/cmd/catalog-api/main.go +++ b/cmd/catalog-api/main.go @@ -43,7 +43,7 @@ func main() { tracing.SetupTracing() defer tracing.TeardownTracing() - // get global Monitor object + // Setup Prometheus metrics m := ginmetrics.GetMonitor() m.SetMetricPath("/metrics") m.SetSlowTime(10) diff --git a/kubernetes/base/deployment.yaml b/kubernetes/base/deployment.yaml index 71aef11..ec64f59 100644 --- a/kubernetes/base/deployment.yaml +++ b/kubernetes/base/deployment.yaml @@ -26,6 +26,10 @@ spec: package: catalog component: api version: v1 + annotations: + prometheus.io/scrape: "true" + prometheus.io/path: '/metrics' + prometheus.io/port: '8000' spec: serviceAccountName: api imagePullSecrets: