diff --git a/.github/workflows/Next-gen-ops-Ind-smart-ci.yml b/.github/workflows/Next-gen-ops-Ind-smart-ci.yml new file mode 100644 index 0000000000000..26fc19e7d3ad2 --- /dev/null +++ b/.github/workflows/Next-gen-ops-Ind-smart-ci.yml @@ -0,0 +1,80 @@ +name: Smart CI Sentinel + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '0 3 * * *' # Daily at 3 AM UTC + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + test-matrix: + name: Test & Diagnose + runs-on: ${{ matrix.os }} + strategy: + matrix: + node-version: [16, 18, 20] + os: [ubuntu-latest, windows-latest] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm ci + + - name: Run tests + id: run-tests + run: | + set +e + npm test > result.log 2>&1 + echo "exit_code=$?" >> $GITHUB_ENV + + - name: Upload test logs + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-logs-${{ matrix.os }}-${{ matrix.node-version }} + path: result.log + + - name: Diagnose failures with AI + if: env.exit_code != '0' + uses: CodexBot/ai-diagnose-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + files: "src/**/*.ts" + + - name: Comment diagnostics on PR + if: github.event_name == 'pull_request' && env.exit_code != '0' + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + 🚨 **Test failures detected** + AI diagnosis has been posted. Please review and address the issues. + + audit-security: + name: Audit & Secure + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Audit dependencies + run: npm audit --audit-level=moderate || true + + - name: Run CodeQL analysis + uses: github/codeql-action/init@v2 + with: + languages: javascript + + - name: Perform CodeQL analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml new file mode 100644 index 0000000000000..a7d5f41c1c6d3 --- /dev/null +++ b/.github/workflows/deno.yml @@ -0,0 +1,173 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# This workflow will install Deno then run `deno lint` and `deno test`. +# For more information see: https://github.com/denoland/setup-deno + +name: Deno + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Setup repo + uses: actions/checkout@v4 + + - name: Setup Deno + # uses: denoland/setup-deno@v1 + uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2 + with: + deno-version: v1.x + + # Uncomment this step to verify the use of 'deno fmt' on each commit. + # - name: Verify formatting + # run: deno fmt --check + + - name: Run linter + run: deno lint + + - name: Cache + uses: actions/cache@v4.3.0 + with: + # A list of files, directories, and wildcard patterns to cache and restore + path: + # An explicit key for restoring and saving the cache + key: + # An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case. + restore-keys: # optional + # The chunk size used to split up large files during upload, in bytes + upload-chunk-size: # optional + # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms + enableCrossOsArchive: # optional, default is false + # Fail the workflow if cache entry is not found + fail-on-cache-miss: # optional, default is false + # Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache + lookup-only: # optional, default is false + # Run the post step to save the cache even if another step before fails + save-always: # optional, default is false + + - name: Run tests + run: deno test -A + + - name: Setup Node.js environment + uses: actions/setup-node@v6.0.0 + with: + # Set always-auth in npmrc. + always-auth: # optional, default is false + # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0. + node-version: # optional + # File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions. + node-version-file: # optional + # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default. + architecture: # optional + # Set this option if you want the action to check for the latest available version that satisfies the version spec. + check-latest: # optional + # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN. + registry-url: # optional + # Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/). + scope: # optional + # Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} + # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm. + cache: # optional + # Set to false to disable automatic caching. By default, caching is enabled when either devEngines.packageManager or the top-level packageManager field in package.json specifies npm as the package manager. + package-manager-cache: # optional, default is true + # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies. + cache-dependency-path: # optional + # Used to specify an alternative mirror to downlooad Node.js binaries from + mirror: # optional + # The token used as Authorization header when fetching from the mirror + mirror-token: # optional + + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4.6.2 + with: + # Artifact name + name: # optional, default is artifact + # A file, directory or wildcard pattern that describes what to upload + path: + # The desired behavior if no files are found using the provided path. +Available Options: + warn: Output a warning but do not fail the action + error: Fail the action with an error message + ignore: Do not output any warnings or errors, the action does not fail + + if-no-files-found: # optional, default is warn + # Duration after which artifact will expire in days. 0 means using default retention. +Minimum 1 day. Maximum 90 days unless changed from the repository settings page. + + retention-days: # optional + # The level of compression for Zlib to be applied to the artifact archive. The value can range from 0 to 9: - 0: No compression - 1: Best speed - 6: Default compression (same as GNU Gzip) - 9: Best compression Higher levels will result in better compression, but will take longer to complete. For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads. + + compression-level: # optional, default is 6 + # If true, an artifact with a matching name will be deleted before a new one is uploaded. If false, the action will fail if an artifact for the given name already exists. Does not fail if the artifact does not exist. + + overwrite: # optional, default is false + # If true, hidden files will be included in the artifact. If false, hidden files will be excluded from the artifact. + + include-hidden-files: # optional, default is false + + - name: Download a Build Artifact + uses: actions/download-artifact@v5.0.0 + with: + # Name of the artifact to download. If unspecified, all artifacts for the run are downloaded. + name: # optional + # IDs of the artifacts to download, comma-separated. Either inputs `artifact-ids` or `name` can be used, but not both. + artifact-ids: # optional + # Destination path. Supports basic tilde expansion. Defaults to $GITHUB_WORKSPACE + path: # optional + # A glob pattern matching the artifacts that should be downloaded. Ignored if name is specified. + pattern: # optional + # When multiple artifacts are matched, this changes the behavior of the destination directories. If true, the downloaded artifacts will be in the same directory specified by path. If false, the downloaded artifacts will be extracted into individual named directories within the specified path. + merge-multiple: # optional, default is false + # The GitHub token used to authenticate with the GitHub API. This is required when downloading artifacts from a different repository or from a different workflow run. If this is not specified, the action will attempt to download artifacts from the current repository and the current workflow run. + github-token: # optional + # The repository owner and the repository name joined together by "/". If github-token is specified, this is the repository that artifacts will be downloaded from. + repository: # optional, default is ${{ github.repository }} + # The id of the workflow run where the desired download artifact was uploaded from. If github-token is specified, this is the run that artifacts will be downloaded from. + run-id: # optional, default is ${{ github.run_id }} + + - name: Setup Go environment + uses: actions/setup-go@v6.0.0 + with: + # The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks. + go-version: # optional + # Path to the go.mod or go.work file. + go-version-file: # optional + # Set this option to true if you want the action to always check for the latest available version that satisfies the version spec + check-latest: # optional + # Used to pull Go distributions from go-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} + # Used to specify whether caching is needed. Set to true, if you'd like to enable caching. + cache: # optional, default is true + # Used to specify the path to a dependency file - go.sum + cache-dependency-path: # optional + # Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default. + architecture: # optional + + + - name: Velocity deploy action + # You may pin to the exact commit or the version. + # uses: codeclimate/velocity-deploy-action@1b4a22f0db113bf8d85c14fd726cf0ec6d17cd13 + uses: codeclimate/velocity-deploy-action@v1.0.0 + with: + # Your Velocity deployment token + token: + # The version tag for the deploy (i.e. `b123`) + version: # optional + # The environment of the deploy (i.e. `production`) + environment: # optional +