Copilot instructions
.github/instructions/build-checkout-prerequisites.instructions.mdCopilot instructions
Quality
81/100
Scores the file, not the repository.Length
714 words
14 headings · 4 code blocksRepository
55k
— · pushed 2 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Build and Checkout Prerequisites for PowerShell CI89This document describes the checkout and build prerequisites used in PowerShell's CI workflows. It is intended for GitHub Copilot sessions working with the build system.1011## Overview1213The PowerShell repository uses a standardized build process across Linux, Windows, and macOS CI workflows. Understanding the checkout configuration and the `Sync-PSTags` operation is crucial for working with the build system.1415## Checkout Configuration1617### Fetch Depth1819All CI workflows that build or test PowerShell use `fetch-depth: 1000` in the checkout step:2021```yaml22- name: checkout23 uses: actions/checkout@v524 with:25 fetch-depth: 100026```2728**Why 1000 commits?**29- The build system needs access to Git history to determine version information30- `Sync-PSTags` requires sufficient history to fetch and work with tags31- 1000 commits provides a reasonable balance between clone speed and having enough history for version calculation32- Shallow clones (fetch-depth: 1) would break versioning logic3334**Exceptions:**35- The `changes` job uses default fetch depth (no explicit `fetch-depth`) since it only needs to detect file changes36- The `analyze` job (CodeQL) uses `fetch-depth: '0'` (full history) for comprehensive security analysis37- Linux packaging uses `fetch-depth: 0` to ensure all tags are available for package version metadata3839### Workflows Using fetch-depth: 10004041- **Linux CI** (`.github/workflows/linux-ci.yml`): All build and test jobs42- **Windows CI** (`.github/workflows/windows-ci.yml`): All build and test jobs43- **macOS CI** (`.github/workflows/macos-ci.yml`): All build and test jobs4445## Sync-PSTags Operation4647### What is Sync-PSTags?4849`Sync-PSTags` is a PowerShell function defined in `build.psm1` that ensures Git tags from the upstream PowerShell repository are synchronized to the local clone.5051### Location5253- **Function Definition**: `build.psm1` (line 36-76)54- **Called From**:55 - `.github/actions/build/ci/action.yml` (Bootstrap step, line 24)56 - `tools/ci.psm1` (Invoke-CIInstall function, line 146)5758### How It Works5960```powershell61Sync-PSTags -AddRemoteIfMissing62```6364The function:651. Searches for a Git remote pointing to the official PowerShell repository:66 - `https://github.com/PowerShell/PowerShell`67 - `git@github.com:PowerShell/PowerShell`68692. If no upstream remote exists and `-AddRemoteIfMissing` is specified:70 - Adds a remote named `upstream` pointing to `https://github.com/PowerShell/PowerShell.git`71723. Fetches all tags from the upstream remote:73```bash74 git fetch --tags --quiet upstream75```76774. Sets `$script:tagsUpToDate = $true` to indicate tags are synchronized7879### Why Sync-PSTags is Required8081Tags are critical for:82- **Version Calculation**: `Get-PSVersion` uses `git describe --abbrev=0` to find the latest tag83- **Build Numbering**: CI builds use tag-based versioning for artifacts84- **Changelog Generation**: Release notes are generated based on tags85- **Package Metadata**: Package versions are derived from Git tags8687Without synchronized tags:88- Version detection would fail or return incorrect versions89- Builds might have inconsistent version numbers90- The build process would error when trying to determine the version9192### Bootstrap Step in CI Action9394The `.github/actions/build/ci/action.yml` includes this in the Bootstrap step:9596```yaml97- name: Bootstrap98 if: success()99 run: |-100 Write-Verbose -Verbose "Running Bootstrap..."101 Import-Module .\tools\ci.psm1102 Invoke-CIInstall -SkipUser103 Write-Verbose -Verbose "Start Sync-PSTags"104 Sync-PSTags -AddRemoteIfMissing105 Write-Verbose -Verbose "End Sync-PSTags"106 shell: pwsh107```108109**Note**: `Sync-PSTags` is called twice:1101. Once by `Invoke-CIInstall` (in `tools/ci.psm1`)1112. Explicitly again in the Bootstrap step112113This redundancy ensures tags are available even if the first call encounters issues.114115## Best Practices for Copilot Sessions116117When working with the PowerShell CI system:1181191. **Always use `fetch-depth: 1000` or greater** when checking out code for build or test operations1202. **Understand that `Sync-PSTags` requires network access** to fetch tags from the upstream repository1213. **Don't modify the fetch-depth without understanding the impact** on version calculation1224. **If adding new CI workflows**, follow the existing pattern:123 - Use `fetch-depth: 1000` for build/test jobs124 - Call `Sync-PSTags -AddRemoteIfMissing` during bootstrap125 - Ensure the upstream remote is properly configured1261275. **For local development**, developers should:128 - Have the upstream remote configured129 - Run `Sync-PSTags -AddRemoteIfMissing` before building130 - Or use `Start-PSBuild` which handles this automatically131132## Related Files133134- `.github/actions/build/ci/action.yml` - Main CI build action135- `.github/workflows/linux-ci.yml` - Linux CI workflow136- `.github/workflows/windows-ci.yml` - Windows CI workflow137- `.github/workflows/macos-ci.yml` - macOS CI workflow138- `build.psm1` - Contains Sync-PSTags function definition139- `tools/ci.psm1` - CI-specific build functions that call Sync-PSTags140141## Summary142143The PowerShell CI system depends on:1441. **Adequate Git history** (fetch-depth: 1000) for version calculation1452. **Synchronized Git tags** via `Sync-PSTags` for accurate versioning1463. **Upstream remote access** to fetch official repository tags147148These prerequisites ensure consistent, accurate build versioning across all CI platforms.149
Also in PowerShell/PowerShell
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| PowerShell/PowerShell.github/instructions/build-and-packaging-steps.instructions.md · 55k | Copilot instructions | buildagent-behaviour | 58/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/build-configuration-guide.instructions.md · 55k | Copilot instructions | buildteststyletesting-strategy+2 | 74/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/code-review-branch-strategy.instructions.md · 55k | Copilot instructions | lint-formatstyletypesgit+1 | 62/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/instruction-file-format.instructions.md · 55k | Copilot instructions | buildlint-formatstylearch+3 | 76/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/log-grouping-guidelines.instructions.md · 55k | Copilot instructions | buildtestdo-not | 77/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/onebranch-condition-syntax.instructions.md · 55k | Copilot instructions | buildstylearchdeployment+1 | 73/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/onebranch-restore-phase-pattern.instructions.md · 55k | Copilot instructions | arch | 54/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/onebranch-signing-configuration.instructions.md · 55k | Copilot instructions | buildstyledeployment | 62/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/pester-set-itresult-pattern.instructions.md · 55k | Copilot instructions | setupstylearch | 62/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/pester-test-status-and-working-meaning.instructions.md · 55k | Copilot instructions | teststyle | 54/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/powershell-automatic-variables.instructions.md · 55k | Copilot instructions | stylearchgitdeployment+1 | 69/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/powershell-module-organization.instructions.md · 55k | Copilot instructions | buildteststylearch+2 | 69/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/powershell-parameter-naming.instructions.md · 55k | Copilot instructions | styledo-not | 65/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/publishing-pester-result.instructions.md · 55k | Copilot instructions | testlint-formatstylearch+3 | 69/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/script-module-file-format.instructions.md · 55k | Copilot instructions | lint-format | 54/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/start-native-execution.instructions.md · 55k | Copilot instructions | buildstylearchgit+1 | 86/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/start-psbuild-basics.instructions.md · 55k | Copilot instructions | buildtesting-strategydeploymentagent-behaviour | 54/100 | 3 days ago | |
| PowerShell/PowerShell.github/instructions/troubleshooting-builds.instructions.md · 55k | Copilot instructions | buildgitdeployment | 54/100 | 3 days ago |
Diff against .github/instructions/build-and-packaging-steps.instructions.md Diff against .github/instructions/build-configuration-guide.instructions.md Diff against .github/instructions/code-review-branch-strategy.instructions.md Diff against .github/instructions/instruction-file-format.instructions.md Diff against .github/instructions/log-grouping-guidelines.instructions.md Diff against .github/instructions/onebranch-condition-syntax.instructions.md Diff against .github/instructions/onebranch-restore-phase-pattern.instructions.md Diff against .github/instructions/onebranch-signing-configuration.instructions.md Diff against .github/instructions/pester-set-itresult-pattern.instructions.md Diff against .github/instructions/pester-test-status-and-working-meaning.instructions.md Diff against .github/instructions/powershell-automatic-variables.instructions.md Diff against .github/instructions/powershell-module-organization.instructions.md Diff against .github/instructions/powershell-parameter-naming.instructions.md Diff against .github/instructions/publishing-pester-result.instructions.md Diff against .github/instructions/script-module-file-format.instructions.md Diff against .github/instructions/start-native-execution.instructions.md Diff against .github/instructions/start-psbuild-basics.instructions.md Diff against .github/instructions/troubleshooting-builds.instructions.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| pytorch/pytorch.github/copilot-instructions.md · 102k | Copilot instructions | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 3 days ago | |
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| dotnet/roslyn.github/instructions/Compiler.instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 99/100 | 3 days ago | |
| hiyouga/LlamaFactory.github/copilot-instructions.md · 74k | Copilot instructions | setupbuildtestlint-format+5 | 97/100 | 2 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| rtk-ai/rtk.github/copilot-instructions.md · 74k | Copilot instructions | buildtestlint-formatstyle+2 | 97/100 | 3 days ago | |
| dotnet/roslyn.github/copilot-instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 97/100 | 3 days ago |
