Repository: aboutcode-org/purldb (language: python)

Issue:
Determine a corresponding source repo(s) (such as Git) for a binary that does not have one obvious
Sometimes we have a package that does not have sources or does not have a corresponding source repo (such as a git repo).
We should be able to infer a source repo and possibly a tag or release in this repo based on other available metadata:
- the homepage may be for a GitHub or GitLab repo or some other field
- for instance a description (seen in NuGet packages) or a README may have a GitHub link

We could also infer the tag based on a version, with or without V prefix.

Use azure pipelines for CI

Use azure pipelines for CI

Use azure pipelines for CI



Discussion / hints:
@TG1999 ping FYI. We may need this for Maven, npm and NuGet
Done in https://github.com/nexB/purldb/pull/137




Fix patch:
diff --git a/Makefile b/Makefile
index 691ba6fc..d4554cc7 100644
--- a/Makefile
+++ b/Makefile
@@ -50,12 +50,11 @@ envfile:
 	@mkdir -p $(shell dirname ${ENV_FILE}) && touch ${ENV_FILE}
 	@echo SECRET_KEY=\"${GET_SECRET_KEY}\" > ${ENV_FILE}
 
-envfile_testing:
-	@echo "-> Create the .env file and generate a secret key"
-	@if test -f ${ENV_FILE}; then echo ".env file exists already"; exit 1; fi
-	@mkdir -p $(shell dirname ${ENV_FILE}) && touch ${ENV_FILE}
-	@echo SECRET_KEY=\"${GET_SECRET_KEY}\" >> ${ENV_FILE}
-	@echo SCANCODEIO_DB_PORT=\"5433\" >> ${ENV_FILE}
+envfile_testing: envfile
+	@echo PACKAGEDB_DB_USER=\"postgres\" >> ${ENV_FILE}
+	@echo PACKAGEDB_DB_PASSWORD=\"postgres\" >> ${ENV_FILE}
+	@echo SCANCODEIO_DB_USER=\"postgres\" >> ${ENV_FILE}
+	@echo SCANCODEIO_DB_PASSWORD=\"postgres\" >> ${ENV_FILE}
 
 isort:
 	@echo "-> Apply isort changes to ensure proper imports ordering"
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index d91cce40..23faf951 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -5,60 +5,30 @@
 # These jobs are using VMs with Azure-provided Python builds
 ################################################################################
 
+resources:
+  containers:
+    - container: postgres
+      image: postgres:13
+      env:
+        POSTGRES_USER: postgres
+        POSTGRES_PASSWORD: postgres
+      ports:
+        - 5432:5432
+
 jobs:
 
     - template: etc/ci/azure-posix.yml
       parameters:
           job_name: ubuntu20_cpython
           image_name: ubuntu-20.04
-          python_versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
+          python_versions: ['3.10', '3.11', '3.12']
           test_suites:
-              all: venv/bin/pytest -n 2 -vvs
+              all: make test
 
     - template: etc/ci/azure-posix.yml
       parameters:
           job_name: ubuntu22_cpython
           image_name: ubuntu-22.04
-          python_versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
-          test_suites:
-              all: venv/bin/pytest -n 2 -vvs
-
-    - template: etc/ci/azure-posix.yml
-      parameters:
-          job_name: macos11_cpython
-          image_name: macOS-11
-          python_versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
-          test_suites:
-              all: venv/bin/pytest -n 2 -vvs
-
-    - template: etc/ci/azure-posix.yml
-      parameters:
-          job_name: macos12_cpython
-          image_name: macOS-12
-          python_versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
-          test_suites:
-              all: venv/bin/pytest -n 2 -vvs
-
-    - template: etc/ci/azure-posix.yml
-      parameters:
-          job_name: macos13_cpython
-          image_name: macOS-13
-          python_versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
-          test_suites:
-              all: venv/bin/pytest -n 2 -vvs
-
-    - template: etc/ci/azure-win.yml
-      parameters:
-          job_name: win2019_cpython
-          image_name: windows-2019
-          python_versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
-          test_suites:
-              all: venv\Scripts\pytest -n 2 -vvs
-
-    - template: etc/ci/azure-win.yml
-      parameters:
-          job_name: win2022_cpython
-          image_name: windows-2022
-          python_versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
+          python_versions: ['3.10', '3.11', '3.12']
           test_suites:
-              all: venv\Scripts\pytest -n 2 -vvs
+              all: make test
diff --git a/etc/ci/azure-posix.yml b/etc/ci/azure-posix.yml
index 9fdc7f15..b139a66c 100644
--- a/etc/ci/azure-posix.yml
+++ b/etc/ci/azure-posix.yml
@@ -18,6 +18,9 @@ jobs:
                      test_suite_label: ${{ tsuite.key }}
                      test_suite: ${{ tsuite.value }}
 
+      services:
+        postgres: postgres
+
       steps:
           - checkout: self
             fetchDepth: 10
@@ -30,9 +33,12 @@ jobs:
                 displayName: '${{ pyver }} - Install Python'
 
               - script: |
-                    python${{ pyver }} --version
-                    echo "python${{ pyver }}" > PYTHON_EXECUTABLE
-                    ./configure --clean && ./configure --dev
+                    make dev
+                    make envfile_testing
+                    sudo mkdir /etc/purldb
+                    sudo cp .env /etc/purldb
+                    sudo mkdir /etc/scancodeio
+                    sudo cp .env /etc/scancodeio
                 displayName: '${{ pyver }} - Configure'
 
               - script: $(test_suite)
diff --git a/purldb_project/settings.py b/purldb_project/settings.py
index 7651b0a0..a9592932 100644
--- a/purldb_project/settings.py
+++ b/purldb_project/settings.py
@@ -107,7 +107,6 @@
 )
 
 # Database
-
 DATABASES = {
     'default': {
         'ENGINE': env.str('PACKAGEDB_DB_ENGINE', 'django.db.backends.postgresql'),


Test patch:
diff --git a/.github/workflows/purldb-tests.yml b/.github/workflows/purldb-tests.yml
deleted file mode 100644
index a88f4026..00000000
--- a/.github/workflows/purldb-tests.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: PurlDB Tests CI
-
-on: [push, pull_request]
-
-env:
-  POSTGRES_DB: packagedb
-  POSTGRES_USER: packagedb
-  POSTGRES_PASSWORD: packagedb
-  POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8
-
-jobs:
-  build:
-    runs-on: ubuntu-20.04
-
-    services:
-      postgres1:
-        image: postgres:13
-        env:
-          POSTGRES_DB: ${{ env.POSTGRES_DB }}
-          POSTGRES_USER: ${{ env.POSTGRES_USER }}
-          POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
-          POSTGRES_INITDB_ARGS: ${{ env.POSTGRES_INITDB_ARGS }}
-        options: >-
-          --health-cmd pg_isready
-          --health-interval 10s
-          --health-timeout 5s
-          --health-retries 5
-        ports:
-          - 5432:5432
-
-      postgres2:
-        image: postgres:13
-        env:
-          POSTGRES_DB: matchcodeio
-          POSTGRES_USER: matchcodeio
-          POSTGRES_PASSWORD: matchcodeio
-          POSTGRES_INITDB_ARGS: ${{ env.POSTGRES_INITDB_ARGS }}
-        options: >-
-          --health-cmd pg_isready
-          --health-interval 10s
-          --health-timeout 5s
-          --health-retries 5
-        ports:
-          - 5433:5432
-
-    strategy:
-      max-parallel: 4
-      matrix:
-        python-version: ["3.10", "3.11"]
-
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v2
-
-      - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v2
-        with:
-          python-version: ${{ matrix.python-version }}
-
-      - name: Install dependencies
-        working-directory: .
-        run: |
-          make dev
-
-      - name: Run tests
-        working-directory: .
-        run: |
-          make envfile_testing
-          sudo mkdir /etc/scancodeio
-          sudo cp .env /etc/scancodeio
-          make test