diff --git a/.github/workflows/go-ci-cd.yaml b/.github/workflows/ci-cd.yaml similarity index 64% rename from .github/workflows/go-ci-cd.yaml rename to .github/workflows/ci-cd.yaml index 3d5bb6f..6faf80c 100644 --- a/.github/workflows/go-ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -7,9 +7,24 @@ on: branches: ["main"] jobs: - lint: + check-changes: + runs-on: ubuntu-latest + outputs: + backend: ${{ steps.changes.outputs.backend }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + backend: + - '!frontend/**' + + lint-backend: name: Vet runs-on: ubuntu-latest + needs: check-changes + if: needs.check-changes.outputs.backend == 'true' steps: - name: Checkout Code uses: actions/checkout@v4 @@ -22,16 +37,18 @@ jobs: - name: Run Go Vet run: go vet ./... - test: + test-backend: name: Test runs-on: ubuntu-latest + needs: check-changes + if: needs.check-changes.outputs.backend == 'true' steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24" # Specify your desired Go version + go-version: "1.24" - name: Install dependencies run: | @@ -41,10 +58,10 @@ jobs: - name: Run tests run: go test -v ./... - build: + build-backend: name: Build runs-on: ubuntu-latest - needs: [test, lint] # Ensure tests and linting pass before building + needs: [test-backend, lint-backend] steps: - name: Checkout Code uses: actions/checkout@v4