Skip to content

Commit b229f85

Browse files
authored
test: run sbom and vulnscan tests regardless of platforms (#98)
1 parent 3f0f303 commit b229f85

2 files changed

Lines changed: 21 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ jobs:
5959
path: ~/.local/share/virtualenvs
6060
key: ${{ runner.os }}-python-${{ env.python_version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
6161
- name: Install the dependencies
62-
run: python -m pip install --upgrade pipenv
62+
run: |
63+
python -m pip install --upgrade pipenv
64+
mkdir "${RUNNER_TEMP}/bin"
65+
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b "${RUNNER_TEMP}/bin"
66+
chmod +x "${RUNNER_TEMP}/bin/syft"
67+
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b "${RUNNER_TEMP}/bin"
68+
chmod +x "${RUNNER_TEMP}/bin/grype"
69+
echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}"
6370
- name: Install Task
6471
uses: arduino/setup-task@v1
6572
- name: Initialize the repo
@@ -89,9 +96,6 @@ jobs:
8996
with:
9097
path: ~/.local/share/virtualenvs
9198
key: ${{ runner.os }}-python-${{ env.python_version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
92-
restore-keys: |
93-
${{ runner.os }}-python-${{ env.python_version }}-pipenv-
94-
${{ runner.os }}-python-
9599
- name: Install the dependencies
96100
run: python -m pip install --upgrade pipenv
97101
- name: Install Task

tests/test_cookiecutter.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,18 @@ def test_default_project(cookies):
171171
# Build and test all supported architectures
172172
env = os.environ.copy()
173173
env["PLATFORM"] = "all"
174-
# We don't test sbom or vulnscan here because multiplatform builds aren't loaded into the local docker daemon
175174
subprocess.run(
176-
["task", "init", "lint", "validate", "build", "test"],
175+
[
176+
"task",
177+
"-v",
178+
"init",
179+
"lint",
180+
"validate",
181+
"build",
182+
"test",
183+
"sbom",
184+
"vulnscan",
185+
],
177186
capture_output=True,
178187
check=True,
179188
cwd=project,
@@ -184,27 +193,17 @@ def test_default_project(cookies):
184193
for platform in ("linux/arm64", "linux/amd64"):
185194
env["PLATFORM"] = platform
186195
subprocess.run(
187-
["task", "build", "test"],
196+
["task", "-v", "build", "test", "sbom", "vulnscan"],
188197
capture_output=True,
189198
check=True,
190199
cwd=project,
191200
env=env,
192201
)
193202

194-
# This is because only the build for the local platform is loaded into the docker daemon
195-
if platform == LOCAL_PLATFORM:
196-
subprocess.run(
197-
["task", "sbom", "vulnscan"],
198-
capture_output=True,
199-
check=True,
200-
cwd=project,
201-
env=env,
202-
)
203-
204203
# Do two releases to ensure they work
205204
for _ in range(2):
206205
subprocess.run(
207-
["task", "release"],
206+
["task", "-v", "release"],
208207
capture_output=True,
209208
check=True,
210209
cwd=project,

0 commit comments

Comments
 (0)