Skip to content

Commit

Permalink
move diff_check to tools folder
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Feb 16, 2024
1 parent a9e631f commit 25819d8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/teamcity-services-diff-check-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
needs: terraform-provider-google-beta
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Download built artifacts
uses: actions/download-artifact@v2
with:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/teamcity-services-diff-check-ga.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
needs: terraform-provider-google
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: this
run: |
cd tools/teamcity-diff-check
go run main.go google services_ga.kt
- name: Download built artifacts
uses: actions/download-artifact@v2
with:
Expand Down Expand Up @@ -51,5 +57,5 @@ jobs:
- name: Diff Check
run: |
cd .teamcity/components/inputs
go run diff_check.go google services_ga.kt
cd tools/teamcity-diff-check
go run main.go google services_ga.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"os"
"os/exec"
"regexp"
)

var serviceFile = flag.String("service_file", "services_ga.kt", "kotlin service file to be parsed")
var provider = flag.String("provider", "google", "Specify which provider to run diff_check on")

func main() {
repo := os.Args
services := fmt.Sprintf("../../../%v/services/...", repo[1])
flag.Parse()
services := fmt.Sprintf("../%v/services/...", *provider)
fmt.Println(services)
cmd := exec.Command("go", "list", services)
stdout, err := cmd.Output()
Expand All @@ -47,8 +51,7 @@ func main() {

////////////////////////////////////////////////////////////////////////////////

service_file := os.Args[2]
f, err := os.Open(service_file)
f, err := os.Open(*serviceFile)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -85,7 +88,7 @@ func main() {
}

if !bytes.Equal(googleServices, teamcityServices) {
fmt.Fprintf(os.Stderr, "error: diff in services_ga.kt\n")
fmt.Fprintf(os.Stderr, "error: diff in %s\n", *serviceFile)
os.Exit(1)
}
}

0 comments on commit 25819d8

Please sign in to comment.