Skip to content

Commit e4ba158

Browse files
authored
Add macos runner as part of the test matrix strategy (#1713)
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent 953c91b commit e4ba158

8 files changed

+87
-25
lines changed

.github/workflows/publish-docker.yml renamed to .github/workflows/publish-docker-image.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Docker image on GHCR
1+
name: Publish Docker image on GitHub Container Registry
22
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions
33

44
on:
@@ -15,8 +15,8 @@ env:
1515
IMAGE_NAME: ${{ github.repository }}
1616

1717
jobs:
18-
build-and-push-image:
19-
runs-on: ubuntu-22.04
18+
build-and-publish-image:
19+
runs-on: ubuntu-24.04
2020

2121
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
2222
permissions:

.github/workflows/pypi-release-aboutcode-pipeline.yml renamed to .github/workflows/publish-pypi-release-aboutcode-pipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Build aboutcode.pipeline Python distributions and publish on PyPI
33
on:
44
workflow_dispatch:
55
push:
6-
tags:
7-
- "aboutcode.pipeline/*"
6+
tags:
7+
- "aboutcode.pipeline/*"
88

99
jobs:
1010
build-and-publish:
1111
name: Build and publish library to PyPI
12-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-24.04
1313

1414
steps:
1515
- uses: actions/checkout@v4

.github/workflows/pypi-release.yml renamed to .github/workflows/publish-pypi-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
build-and-publish:
1111
name: Build and publish library to PyPI
12-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-24.04
1313

1414
steps:
1515
- uses: actions/checkout@v4

.github/workflows/ci-docker.yml renamed to .github/workflows/run-unit-tests-docker.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
name: Test on Docker CI
1+
name: Run unit tests on Docker container
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
412

513
jobs:
6-
build:
7-
runs-on: ubuntu-22.04
14+
run-unit-tests:
15+
runs-on: ubuntu-24.04
816

917
steps:
1018
- name: Checkout code
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Run unit tests on macOS
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
POSTGRES_DB: scancodeio
15+
POSTGRES_USER: scancodeio
16+
POSTGRES_PASSWORD: scancodeio
17+
18+
jobs:
19+
run-unit-tests:
20+
runs-on: macos-13
21+
22+
strategy:
23+
matrix:
24+
python-version: ["3.10", "3.11", "3.12", "3.13"]
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: ikalnytskyi/action-setup-postgres@v7
37+
id: postgres
38+
with:
39+
postgres-version: "14" # 13 is not supported.
40+
database: ${{ env.POSTGRES_DB }}
41+
username: ${{ env.POSTGRES_USER }}
42+
password: ${{ env.POSTGRES_PASSWORD }}
43+
port: 5432
44+
45+
- name: Install Python dependencies
46+
run: make dev envfile
47+
48+
- name: Run Django tests
49+
run: .venv/bin/python manage.py test --verbosity=2 --noinput
50+
env:
51+
SCANCODEIO_DB_NAME: ${{ env.POSTGRES_DB }}
52+
SCANCODEIO_DB_USER: ${{ env.POSTGRES_USER }}
53+
SCANCODEIO_DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }}

.github/workflows/ci.yml renamed to .github/workflows/run-unit-tests.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
name: Test CI
1+
name: Run unit tests
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
412

513
env:
614
POSTGRES_DB: scancodeio
@@ -9,8 +17,8 @@ env:
917
POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8
1018

1119
jobs:
12-
build:
13-
runs-on: ubuntu-22.04
20+
run-unit-tests:
21+
runs-on: ubuntu-24.04
1422

1523
services:
1624
postgres:

scanpipe/tests/pipes/test_scancode.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ def test_scanpipe_pipes_scancode_extract_archive_errors(self):
7979
errors = scancode.extract_archive(input_location, target)
8080

8181
error_message = "gzip decompression failed"
82-
if sys.platform == "darwin":
83-
error_message += " (zlib returned error -3, msg invalid code lengths set)"
84-
85-
expected = {input_location: [error_message]}
86-
self.assertEqual(expected, errors)
82+
self.assertIn(error_message, errors[str(input_location)][0])
8783

8884
def test_scanpipe_pipes_scancode_extract_archives(self):
8985
tempdir = Path(tempfile.mkdtemp())
@@ -113,11 +109,7 @@ def test_scanpipe_pipes_scancode_extract_archives_errors(self):
113109
errors = scancode.extract_archives(tempdir)
114110

115111
error_message = "gzip decompression failed"
116-
if sys.platform == "darwin":
117-
error_message += " (zlib returned error -3, msg invalid code lengths set)"
118-
119-
expected = {str(target): [error_message]}
120-
self.assertEqual(expected, errors)
112+
self.assertIn(error_message, errors[str(target)][0])
121113

122114
@skipIf(sys.platform != "linux", "QCOW2 extraction is not available on macOS.")
123115
def test_scanpipe_pipes_scancode_extract_archive_vmimage_qcow2(self):

scanpipe/tests/test_pipelines.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ def test_scanpipe_inspect_packages_with_resolved_dependencies_poetry(self):
966966
)
967967
self.assertPipelineResultEqual(expected_file, result_file)
968968

969+
@skipIf(sys.platform == "darwin", "Not supported on macOS")
969970
def test_scanpipe_resolved_dependencies_cocoapods(self):
970971
pipeline_name = "resolve_dependencies"
971972
project1 = make_project()

0 commit comments

Comments
 (0)