diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4941698..4064183 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,10 +4,32 @@ on: push: pull_request: +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + jobs: + # Ensure terraform is valid + terraform-validate: + name: Terraform validate + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: hashicorp/setup-terraform@v3 + - name: Terraform Initialize + working-directory: ChatInfra + run: terraform init -backend=false + + - name: Terraform validate + working-directory: ChatInfra + run: terraform validate + + # If terraform is valid check terraform formatting terraform-format: name: Terraform Format runs-on: ubuntu-latest + needs: [terraform-validate] steps: - uses: actions/checkout@v4 @@ -16,9 +38,11 @@ jobs: working-directory: ChatInfra run: terraform fmt -recursive -check + # If terraform format is valid check server formatting chat-server-format: name: ChatServer Format runs-on: ubuntu-latest + needs: [terraform-format] steps: - uses: actions/checkout@v4 @@ -32,6 +56,7 @@ jobs: working-directory: ChatServer run: ./gradlew ktlintCheck + # If terraform formet is vaild check api tests api-tests: name: API Tests runs-on: ubuntu-latest @@ -55,10 +80,11 @@ jobs: working-directory: ApiServer run: python -m pytest + # If terraform format is valid check presence tests presence-tests: name: Presence Tests runs-on: ubuntu-latest - needs: [ terraform-format ] + needs: [terraform-format] steps: - uses: actions/checkout@v4 @@ -78,6 +104,7 @@ jobs: working-directory: PresenceServer run: python -m pytest + # If chatserver format is valid check chatserver tests chat-server-tests: name: Chat Server Tests runs-on: ubuntu-latest