diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker-image.yml similarity index 95% rename from .github/workflows/publish-docker.yml rename to .github/workflows/publish-docker-image.yml index 98bd61decb..be24c863d8 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker-image.yml @@ -1,4 +1,4 @@ -name: Publish Docker image on GHCR +name: Publish Docker image on GitHub Container Registry # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions on: @@ -15,8 +15,8 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push-image: - runs-on: ubuntu-22.04 + build-and-publish-image: + runs-on: ubuntu-24.04 # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. permissions: diff --git a/.github/workflows/pypi-release-aboutcode-pipeline.yml b/.github/workflows/publish-pypi-release-aboutcode-pipeline.yml similarity index 93% rename from .github/workflows/pypi-release-aboutcode-pipeline.yml rename to .github/workflows/publish-pypi-release-aboutcode-pipeline.yml index 115f9841a3..cdadc18dc9 100644 --- a/.github/workflows/pypi-release-aboutcode-pipeline.yml +++ b/.github/workflows/publish-pypi-release-aboutcode-pipeline.yml @@ -3,13 +3,13 @@ name: Build aboutcode.pipeline Python distributions and publish on PyPI on: workflow_dispatch: push: - tags: - - "aboutcode.pipeline/*" + tags: + - "aboutcode.pipeline/*" jobs: build-and-publish: name: Build and publish library to PyPI - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/publish-pypi-release.yml similarity index 97% rename from .github/workflows/pypi-release.yml rename to .github/workflows/publish-pypi-release.yml index 84ea29381c..f5a217d736 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/publish-pypi-release.yml @@ -9,7 +9,7 @@ on: jobs: build-and-publish: name: Build and publish library to PyPI - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/run-unit-tests-docker.yml similarity index 66% rename from .github/workflows/ci-docker.yml rename to .github/workflows/run-unit-tests-docker.yml index aaef6e3d9b..609fdfab09 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/run-unit-tests-docker.yml @@ -1,10 +1,18 @@ -name: Test on Docker CI +name: Run unit tests on Docker container -on: [push, pull_request] +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +permissions: + contents: read jobs: - build: - runs-on: ubuntu-22.04 + run-unit-tests: + runs-on: ubuntu-24.04 steps: - name: Checkout code diff --git a/.github/workflows/run-unit-tests-macos.yml b/.github/workflows/run-unit-tests-macos.yml new file mode 100644 index 0000000000..8a1510079a --- /dev/null +++ b/.github/workflows/run-unit-tests-macos.yml @@ -0,0 +1,53 @@ +name: Run unit tests on macOS + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +env: + POSTGRES_DB: scancodeio + POSTGRES_USER: scancodeio + POSTGRES_PASSWORD: scancodeio + +jobs: + run-unit-tests: + runs-on: macos-13 + + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up Python ${{ matrix.python-version }} + uses: ikalnytskyi/action-setup-postgres@v7 + id: postgres + with: + postgres-version: "14" # 13 is not supported. + database: ${{ env.POSTGRES_DB }} + username: ${{ env.POSTGRES_USER }} + password: ${{ env.POSTGRES_PASSWORD }} + port: 5432 + + - name: Install Python dependencies + run: make dev envfile + + - name: Run Django tests + run: .venv/bin/python manage.py test --verbosity=2 --noinput + env: + SCANCODEIO_DB_NAME: ${{ env.POSTGRES_DB }} + SCANCODEIO_DB_USER: ${{ env.POSTGRES_USER }} + SCANCODEIO_DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }} diff --git a/.github/workflows/ci.yml b/.github/workflows/run-unit-tests.yml similarity index 90% rename from .github/workflows/ci.yml rename to .github/workflows/run-unit-tests.yml index 57c321664d..44ec2517fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/run-unit-tests.yml @@ -1,6 +1,14 @@ -name: Test CI +name: Run unit tests -on: [push, pull_request] +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +permissions: + contents: read env: POSTGRES_DB: scancodeio @@ -9,8 +17,8 @@ env: POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8 jobs: - build: - runs-on: ubuntu-22.04 + run-unit-tests: + runs-on: ubuntu-24.04 services: postgres: diff --git a/scanpipe/tests/pipes/test_scancode.py b/scanpipe/tests/pipes/test_scancode.py index 2e729a2748..fbaeda2476 100644 --- a/scanpipe/tests/pipes/test_scancode.py +++ b/scanpipe/tests/pipes/test_scancode.py @@ -79,11 +79,7 @@ def test_scanpipe_pipes_scancode_extract_archive_errors(self): errors = scancode.extract_archive(input_location, target) error_message = "gzip decompression failed" - if sys.platform == "darwin": - error_message += " (zlib returned error -3, msg invalid code lengths set)" - - expected = {input_location: [error_message]} - self.assertEqual(expected, errors) + self.assertIn(error_message, errors[str(input_location)][0]) def test_scanpipe_pipes_scancode_extract_archives(self): tempdir = Path(tempfile.mkdtemp()) @@ -113,11 +109,7 @@ def test_scanpipe_pipes_scancode_extract_archives_errors(self): errors = scancode.extract_archives(tempdir) error_message = "gzip decompression failed" - if sys.platform == "darwin": - error_message += " (zlib returned error -3, msg invalid code lengths set)" - - expected = {str(target): [error_message]} - self.assertEqual(expected, errors) + self.assertIn(error_message, errors[str(target)][0]) @skipIf(sys.platform != "linux", "QCOW2 extraction is not available on macOS.") def test_scanpipe_pipes_scancode_extract_archive_vmimage_qcow2(self): diff --git a/scanpipe/tests/test_pipelines.py b/scanpipe/tests/test_pipelines.py index 21cefc4168..0852bc8418 100644 --- a/scanpipe/tests/test_pipelines.py +++ b/scanpipe/tests/test_pipelines.py @@ -966,6 +966,7 @@ def test_scanpipe_inspect_packages_with_resolved_dependencies_poetry(self): ) self.assertPipelineResultEqual(expected_file, result_file) + @skipIf(sys.platform == "darwin", "Not supported on macOS") def test_scanpipe_resolved_dependencies_cocoapods(self): pipeline_name = "resolve_dependencies" project1 = make_project()