feat: add MultiCache wrapper for multi-tier caching strategies #26
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
| name: CI | |
| on: | |
| push: | |
| branches: [master, main, develop] | |
| paths-ignore: | |
| - "**.md" | |
| - "LICENSE.txt" | |
| - ".gitignore" | |
| - "context/**" | |
| - "TODO.md" | |
| - "examples/**/README.md" | |
| pull_request: | |
| branches: [master, main, develop] | |
| paths-ignore: | |
| - "**.md" | |
| - "LICENSE.txt" | |
| - ".gitignore" | |
| - "context/**" | |
| - "TODO.md" | |
| - "examples/**/README.md" | |
| jobs: | |
| test: | |
| name: Test | |
| 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.25" | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-1.25-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go-1.25- | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Run tests | |
| shell: bash | |
| run: go test -v -race -coverprofile=coverage.out -covermode=atomic $(go list ./... | grep -v '/examples/') | |
| - name: Upload coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| lint: | |
| name: Lint | |
| 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.25" | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |
| format: | |
| name: Format Check | |
| 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.25" | |
| - name: Check formatting | |
| run: | | |
| if [ -n "$(gofmt -s -l .)" ]; then | |
| echo "Code is not formatted. Please run 'gofmt -s -w .'" | |
| gofmt -s -d . | |
| exit 1 | |
| fi | |
| build-examples: | |
| name: Build Examples | |
| 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.25" | |
| - name: Build basic example | |
| run: go build -o /tmp/basic ./examples/basic/main.go | |
| - name: Build diskcache example | |
| run: go build -o /tmp/diskcache ./examples/diskcache/main.go | |
| - name: Build leveldb example | |
| run: go build -o /tmp/leveldb ./examples/leveldb/main.go | |
| - name: Build redis example | |
| run: go build -o /tmp/redis ./examples/redis/main.go | |
| - name: Build custom-backend example | |
| run: go build -o /tmp/custom-backend ./examples/custom-backend/main.go | |
| integration-redis: | |
| name: Integration Tests (Redis) | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| - name: Run Redis tests | |
| run: go test -v ./redis/... | |
| env: | |
| REDIS_URL: localhost:6379 | |
| integration-memcache: | |
| name: Integration Tests (Memcache) | |
| runs-on: ubuntu-latest | |
| services: | |
| memcached: | |
| image: memcached:1.6-alpine | |
| ports: | |
| - 11211:11211 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| - name: Run Memcache tests | |
| run: go test -v ./memcache/... | |
| env: | |
| MEMCACHE_URL: localhost:11211 |