Skip to content
Snippets Groups Projects
Select Git revision
  • 7f32b5f87c2fc5f294e82d3aaecc085b873da799
  • master default protected
  • uv
  • 0.1.422
  • 0.1.421
  • 0.1.420
  • 0.1.419
  • 0.1.418
  • 0.1.417
  • 0.1.416
  • 0.1.415
  • 0.1.414
  • 0.1.413
  • 0.1.412
  • 0.1.411
  • 0.1.410
  • 0.1.409
  • 0.1.408
  • 0.1.407
  • 0.1.406
  • 0.1.405
  • 0.1.404
  • 0.1.403
23 results

gitlab-ci.ts

Blame
  • gitlab-ci.ts 16.02 KiB
    import toml from "@ltd/j-toml"
    import assert from "assert"
    import { $, fetch, fs } from "zx"
    
    interface Package {
      name: string
      version: string
    }
    
    interface PyProject {
      tool: {
        poetry: {
          dependencies: { [name: string]: string | PyProjectDependencyObject }
          extras: { [name: string]: string[] }
          name: string
          version: string
        }
      }
    }
    
    interface PyProjectDependencyObject {
      branch?: string
      git?: string
      optional?: boolean
      version?: string
    }
    
    export interface VersionObject {
      major: number
      minor: number
      patch: number
    }
    
    const {
      CI_COMMIT_BRANCH,
      CI_COMMIT_TAG,
      CI_COMMIT_TITLE,
      CI_DEFAULT_BRANCH,
      CI_JOB_TOKEN,
      CI_PIPELINE_SOURCE,
      CI_PROJECT_NAME,
      CI_PROJECT_NAMESPACE,
      CI_SERVER_HOST,
      CI_SERVER_URL,
      SSH_KNOWN_HOSTS,
      SSH_PRIVATE_KEY,
    } = process.env
    const dependenciesName = [
      "openfisca-france-reforms",
      // "openfisca-france-with-indirect-taxation",
    ]
    const packagePath = "package.json"
    const poetryLockPath = "poetry.lock"
    const pyProjectTomlPath = "pyproject.toml"
    
    function checkVersionObject(
      {
        major: majorReference,
        minor: minorReference,
        patch: patchReference,
      }: VersionObject,
      versionObject: VersionObject | undefined,
    ): boolean {
      if (versionObject === undefined) {
        return true
      }
      const { major, minor, patch } = versionObject
      if (major < majorReference) {
        return true
      }