feat: Updating all the latest work and adding new users feature #42
This file contains hidden or 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
| # Copyright 2026 Elementum Ltd. All Rights Reserved. | |
| # Licensed under the Apache License, Version 2.0 | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ---------- License header check ---------- | |
| license-header-check: | |
| name: License Headers | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Verify Apache 2.0 license headers | |
| run: | | |
| CURRENT_YEAR=$(date -u +%Y) | |
| FAILED=0 | |
| EXPECTED_HEADER="// Copyright ${CURRENT_YEAR} Elementum Ltd. All Rights Reserved. | |
| // | |
| // Licensed under the Apache License, Version 2.0 (the \"License\"); | |
| // you may not use this file except in compliance with the License. | |
| // You may obtain a copy of the License at | |
| // | |
| // http://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software | |
| // distributed under the License is distributed on an \"AS IS\" BASIS, | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| // See the License for the specific language governing permissions and | |
| // limitations under the License." | |
| while IFS= read -r -d '' file; do | |
| ACTUAL_HEADER=$(head -n 13 "$file") | |
| if [ "$ACTUAL_HEADER" != "$EXPECTED_HEADER" ]; then | |
| echo "::error file=${file}::Missing or incorrect license header (expected copyright year ${CURRENT_YEAR})" | |
| FAILED=1 | |
| fi | |
| done < <(find . -name '*.go' -not -path './internal/client/generated.go' -print0) | |
| if [ "$FAILED" -eq 1 ]; then | |
| echo "" | |
| echo "One or more .go files have a missing or incorrect Apache 2.0 license header." | |
| echo "Expected the first 13 lines to be:" | |
| echo "" | |
| echo "$EXPECTED_HEADER" | |
| exit 1 | |
| fi | |
| echo "All .go files have the correct license header with copyright year ${CURRENT_YEAR}." | |
| # ---------- go mod tidy check ---------- | |
| go-mod-tidy-check: | |
| name: go mod tidy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Check go mod tidy | |
| run: | | |
| go mod tidy | |
| git diff --exit-code go.mod go.sum || { | |
| echo "::error::go.mod or go.sum is not tidy. Run 'go mod tidy' and commit the changes." | |
| exit 1 | |
| } | |
| # ---------- Vet ---------- | |
| vet: | |
| name: Vet | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - run: go vet ./... | |
| # ---------- Lint ---------- | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 | |
| # ---------- Unit tests ---------- | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - run: go test ./... | |
| # ---------- Build ---------- | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - run: go build ./... | |
| # ---------- Integration tests (placeholder) ---------- | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Placeholder | |
| run: echo "Integration tests coming soon." |