Skip to content

Commit fc64f42

Browse files
committed
Remove merge lines from workflows
I just copied over the workflow files from cisagov/skeleton-ansible-role-with-test-user. We will be changing this repo's upstream to cisagov/skeleton-ansible-role-with-test-user anyway.
1 parent f155ddc commit fc64f42

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

.github/workflows/build.yml

+33-27
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ jobs:
1919
steps:
2020
- uses: cisagov/setup-env-github-action@develop
2121
- uses: actions/checkout@v2
22-
- name: Set up Python
23-
uses: actions/setup-python@v2
22+
- uses: actions/setup-python@v2
2423
with:
2524
python-version: 3.8
2625
- uses: actions/setup-go@v2
@@ -30,31 +29,40 @@ jobs:
3029
run: |
3130
echo "::set-env name=PY_VERSION::"\
3231
"$(python -c "import platform;print(platform.python_version())")"
32+
- name: Store installed Go version
33+
run: |
34+
echo "::set-env name=GO_VERSION::"\
35+
"$(go version | sed 's/^go version go\([0-9.]\+\) .*/\1/')"
36+
- name: Lookup go cache directory
37+
id: go-cache
38+
run: |
39+
echo "::set-output name=dir::$(go env GOCACHE)"
3340
- name: Cache linting environments
3441
uses: actions/cache@v2
3542
with:
43+
# Note that the .terraform directory IS NOT included in the
44+
# cache because if we were caching, then we would need to use
45+
# the `-upgrade=true` option. This option blindly pulls down the
46+
# latest modules and providers instead of checking to see if an
47+
# update is required. That behavior defeats the benefits of caching.
48+
# so there is no point in doing it for the .terraform directory.
3649
path: |
3750
${{ env.PIP_CACHE_DIR }}
3851
${{ env.PRE_COMMIT_CACHE_DIR }}
39-
key: "lint-${{ runner.os }}-py${{ env.PY_VERSION }}-\
52+
${{ env.CURL_CACHE_DIR }}
53+
${{ steps.go-cache.outputs.dir }}
54+
key: "lint-${{ runner.os }}-\
55+
py${{ env.PY_VERSION }}-\
56+
go${{ env.GO_VERSION }}-\
57+
tf${{ env.TERRAFORM_VERSION }}-\
4058
${{ hashFiles('**/requirements-test.txt') }}-\
4159
${{ hashFiles('**/.pre-commit-config.yaml') }}"
42-
<<<<<<< HEAD
43-
- name: Cache curl downloads
44-
uses: actions/cache@v1
45-
with:
46-
path: ${{ env.CURL_CACHE_DIR }}
47-
key: "${{ runner.os }}-curl-\
48-
terraform-${{ env.TERRAFORM_VERSION }}"
49-
- name: Lookup go cache directory
50-
id: go-cache
51-
run: |
52-
echo "::set-output name=dir::$(go env GOCACHE)"
53-
- name: Cache go
54-
uses: actions/cache@v1
55-
with:
56-
path: ${{ steps.go-cache.outputs.dir }}
57-
key: "${{ runner.os }}-go"
60+
restore-keys: |
61+
lint-${{ runner.os }}-\
62+
py${{ env.PY_VERSION }}-\
63+
go${{ env.GO_VERSION }}-\
64+
tf${{ env.TERRAFORM_VERSION }}-
65+
lint-${{ runner.os }}-
5866
- name: Install Terraform
5967
run: |
6068
mkdir -p ${{ env.CURL_CACHE_DIR }}
@@ -66,19 +74,17 @@ jobs:
6674
sudo unzip -d /opt/terraform \
6775
${{ env.CURL_CACHE_DIR }}/"${TERRAFORM_ZIP}"
6876
sudo ln -s /opt/terraform/terraform /usr/bin/terraform
77+
sudo mv /usr/local/bin/terraform /usr/local/bin/terraform-default
78+
sudo ln -s /opt/terraform/terraform /usr/local/bin/terraform
6979
- name: Install Terraform-docs
7080
run: GO111MODULE=on go get github.com/segmentio/terraform-docs
7181
- name: Find and initialize Terraform directories
7282
run: |
73-
for path in [[ $(find . -type f -iname "*.tf" -exec dirname "{}" \; \
74-
| sort -u) ]]; do \
75-
terraform init -upgrade=true -input=false -backend=false "$path"; \
83+
for path in $(find . -not \( -type d -name ".terraform" -prune \) \
84+
-type f -iname "*.tf" -exec dirname "{}" \; | sort -u); do \
85+
echo "Initializing '$path'..."; \
86+
terraform init -input=false -backend=false "$path"; \
7687
done
77-
=======
78-
restore-keys: |
79-
lint-${{ runner.os }}-py${{ env.PY_VERSION }}-
80-
lint-${{ runner.os }}-
81-
>>>>>>> 05c10e6aff9ff1f827e3b4b10511f9b28fa05b71
8288
- name: Install dependencies
8389
run: |
8490
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)