Skip to content

Commit

Permalink
add weekly workflow for teamcity diff check
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Mar 6, 2024
1 parent f03b2c8 commit 2304e5c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
48 changes: 26 additions & 22 deletions .github/workflows/teamcity-services-diff-check-weekly.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
name: TeamCity Services Weekly Diff Check
name: TeamCity Services Diff Check
permissions: read-all

on:
# Enable ad hoc checks
workflow_dispatch:

# Scheduled checks to catch edge cases
schedule:
# Every Tuesday morning
# Runs every tuesday morning
- cron: '0 4 * * 2'

jobs:
terraform-provider-google:
uses: ./.github/workflows/build-downstream.yml
with:
repo: 'terraform-provider-google'

terraform-provider-google-beta:
uses: ./.github/workflows/build-downstream.yml
with:
repo: 'terraform-provider-google-beta'

teamcity-services-diff-check:
needs: [terraform-provider-google, terraform-provider-google-beta]
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '^1.20'

- uses: actions/checkout@v3

- name: Download built artifacts - GA provider
uses: actions/download-artifact@v2
with:
name: artifact-terraform-provider-google
path: artifacts

- name: Unzip the artifacts and delete the zip
run: |
unzip -o artifacts/output.zip -d ./provider
Expand All @@ -49,19 +39,33 @@ jobs:
with:
name: artifact-terraform-provider-google-beta
path: artifacts

- name: Unzip the artifacts and delete the zip
run: |
unzip -o artifacts/output.zip -d ./provider
rm artifacts/output.zip
- name: Check that new services have been added to the TeamCity configuration code
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '^1.20'

- name: Cache Go modules and build cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-test-terraform-provider-google-${{hashFiles('go.sum','google-*/transport/**','google-*/tpgresource/**','google-*/acctest/**','google-*/envvar/**','google-*/sweeper/**','google-*/verify/**') }}
restore-keys: |
${{ runner.os }}-test-terraform-provider-google-${{ hashFiles('go.sum') }}
${{ runner.os }}-test-terraform-provider-google-
- name: Diff Check
run: |
# Create lists of service packages in providers
ls provider/google/services > tools/teamcity-diff-check/services_ga.txt
ls provider/google-beta/services > tools/teamcity-diff-check/services_beta.txt
# Run tool to compare service packages in the providers vs those listed in TeamCity config files
cd tools/teamcity-diff-check
go run main.go -service_file=services_ga
go run main.go -service_file=services_beta
6 changes: 5 additions & 1 deletion .github/workflows/teamcity-services-diff-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ jobs:
check-pr:
runs-on: ubuntu-22.04
steps:
- name: Check for New Services
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: services
name: "Check for New Services"
run: |
newServices=$(($(git diff --name-only --diff-filter=A origin/main HEAD | grep "mmv1/products" | wc -l)))
if [ "$newServices" != "0" ];then
Expand Down

0 comments on commit 2304e5c

Please sign in to comment.