Fix workflow path filters for repository root structure
This commit is contained in:
@@ -62,7 +62,6 @@ jobs:
|
||||
pack config default-builder paketobuildpacks/builder-jammy-tiny:latest
|
||||
|
||||
- name: Prepare build environment
|
||||
working-directory: backend
|
||||
run: |
|
||||
# Create .env.production for build (no secrets, just structure)
|
||||
cat > .env.production << EOF
|
||||
@@ -77,15 +76,15 @@ jobs:
|
||||
run: |
|
||||
PACK_ARGS=(
|
||||
"${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
--path backend
|
||||
--path .
|
||||
)
|
||||
|
||||
if [ -n "$PACK_DOCKER_HOST" ]; then
|
||||
PACK_ARGS+=(--docker-host "$PACK_DOCKER_HOST")
|
||||
fi
|
||||
|
||||
if [ -f "backend/.env.production" ]; then
|
||||
PACK_ARGS+=(--env-file backend/.env.production)
|
||||
if [ -f ".env.production" ]; then
|
||||
PACK_ARGS+=(--env-file .env.production)
|
||||
fi
|
||||
|
||||
pack build "${PACK_ARGS[@]}"
|
||||
|
||||
@@ -7,14 +7,20 @@ on:
|
||||
- production
|
||||
- develop
|
||||
paths:
|
||||
- 'backend/**'
|
||||
- '**/*.go'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
- '.gitea/workflows/test.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- production
|
||||
- develop
|
||||
paths:
|
||||
- 'backend/**'
|
||||
- '**/*.go'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
- '.gitea/workflows/test.yml'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -34,23 +40,21 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: backend
|
||||
run: go mod download
|
||||
|
||||
- name: Run tests
|
||||
working-directory: backend
|
||||
run: go test -v -race -coverprofile=coverage.out ./...
|
||||
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@v4
|
||||
if: always()
|
||||
with:
|
||||
file: ./backend/coverage.out
|
||||
file: ./coverage.out
|
||||
flags: backend
|
||||
name: backend-coverage
|
||||
|
||||
@@ -71,4 +75,3 @@ jobs:
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
with:
|
||||
version: latest
|
||||
working-directory: backend
|
||||
|
||||
Reference in New Issue
Block a user