-
Notifications
You must be signed in to change notification settings - Fork 1.7k
79 lines (62 loc) · 2.45 KB
/
build-downstream.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: magic-modules
permissions: read-all
on:
pull_request:
jobs:
lint-yaml:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
path: repo
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.1'
bundler-cache: true
- run: bundle exec rake
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '^1.19'
# Cache Go modules
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go install golang.org/x/tools/cmd/goimports@latest
- name: Build terraform-provider-google-beta
run: |
set -e
function clone_repo() {
UPSTREAM_OWNER=hashicorp
GH_REPO=terraform-provider-google-beta
LOCAL_PATH=$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta
GITHUB_PATH=https://modular-magician:[email protected]/$UPSTREAM_OWNER/$GH_REPO
mkdir -p "$(dirname $LOCAL_PATH)"
git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH
}
if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN environment variable is missing."
exit 1
fi
clone_repo
git config --local user.name "Modular Magician"
git config --local user.email "[email protected]"
pushd mmv1
pushd $LOCAL_PATH
go mod download
find . -type f -not -wholename "./.git*" -not -wholename "./.changelog*" -not -name ".travis.yml" -not -name ".golangci.yml" -not -name "CHANGELOG.md" -not -name "CHANGELOG_v*.md" -not -name "GNUmakefile" -not -name "docscheck.sh" -not -name "LICENSE" -not -name "README.md" -not -wholename "./examples*" -not -name ".go-version" -not -name ".hashibot.hcl" -print0 | xargs -0 git rm
popd
# Extracted build process from the script:
bundle exec compiler.rb -a -e terraform -o $LOCAL_PATH -v beta
pushd ../
make tpgtools OUTPUT_PATH=$LOCAL_PATH VERSION=beta
make teamcity-servicemap-generate OUTPUT_PATH=$LOCAL_PATH VERSION=beta
popd
popd