name: Build and Test Auth Service on: push: branches: [ main, develop, 'feature/**' ] paths: - 'backend/functions/auth-service/**' - '.gitea/workflows/build-backend-auth.yml' pull_request: branches: [ main, develop ] paths: - 'backend/functions/auth-service/**' jobs: build-and-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-auth-${{ hashFiles('backend/functions/auth-service/go.sum') }} restore-keys: | ${{ runner.os }}-go-auth- - name: Download dependencies working-directory: ./backend/functions/auth-service run: go mod download - name: Verify dependencies working-directory: ./backend/functions/auth-service run: go mod verify - name: Run go vet working-directory: ./backend/functions/auth-service run: go vet ./... - name: Run tests working-directory: ./backend/functions/auth-service run: go test -v -race -coverprofile=coverage.out ./... - name: Build binary working-directory: ./backend/functions/auth-service run: go build -v -o auth-service main.go - name: Build container image working-directory: ./backend/functions/auth-service run: | podman build -t coppertone-auth-service:${{ github.sha }} -f Containerfile . podman build -t coppertone-auth-service:latest -f Containerfile . - name: Upload coverage uses: actions/upload-artifact@v4 with: name: auth-service-coverage path: backend/functions/auth-service/coverage.out - name: Upload binary uses: actions/upload-artifact@v4 with: name: auth-service-binary path: backend/functions/auth-service/auth-service