Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vedantmgoyal9 committed Oct 19, 2024
1 parent 8f3a182 commit 3e66622
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 61 deletions.
74 changes: 32 additions & 42 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,63 +17,53 @@ permissions:

jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
dotnet-runtime: win-x64
rust-target: x86_64-pc-windows-msvc
- os: windows-latest
dotnet-runtime: win-arm64
rust-target: aarch64-pc-windows-msvc
- os: ubuntu-latest
dotnet-runtime: linux-x64
rust-target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
dotnet-runtime: linux-arm64
rust-target: aarch64-unknown-linux-gnu
- os: macos-latest
dotnet-runtime: osx-arm64
rust-target: aarch64-apple-darwin
bin-suffix: macos-arm64
runs-on: ${{ matrix.os }}
runs-on: windows-latest
defaults:
run:
shell: bash
shell: pwsh
steps:
- uses: actions/checkout@v4
with:
submodules: true
lfs: true
persist-credentials: false

- uses: moonrepo/setup-rust@v1
with:
channel: stable
targets: ${{ matrix.rust-target }}
cache: false

- if: matrix.rust-target == 'aarch64-unknown-linux-gnu'
- name: Setup Rust and Zig
run: |
sudo sed -i -e 's/deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports noble-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
sudo dpkg --add-architecture arm64
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
rustup target add aarch64-pc-windows-msvc
rustup target add x86_64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
choco install zig
iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
cargo binstall cargo-zigbuild -y
- run: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="aarch64-linux-gnu-gcc" cargo build -r --target ${{ matrix.rust-target }}
- name: Build rust-msi
run: |
cargo build --release --target x86_64-pc-windows-msvc
cargo build --release --target aarch64-pc-windows-msvc
cargo zigbuild --release --target x86_64-unknown-linux-gnu
cargo zigbuild --release --target aarch64-unknown-linux-gnu
working-directory: src/WingetCreateCore/Common/Msi/rust-msi

- run: dotnet publish ./WingetCreateCLI.csproj -c Release -r ${{ matrix.dotnet-runtime }} --output ./output
- run: dotnet publish ./WingetCreateCLI.csproj -c Release -r win-x64 --output ./output/win-x64
working-directory: src/WingetCreateCLI

- if: matrix.os != 'windows-latest'
run: mv src/WingetCreateCLI/output/WingetCreateCLI ./wingetcreate-${{ matrix.bin-suffix || matrix.dotnet-runtime }}
- run: dotnet publish ./WingetCreateCLI.csproj -c Release -r win-arm64 --output ./output/win-arm64
working-directory: src/WingetCreateCLI

- if: matrix.os == 'windows-latest'
run: mv src/WingetCreateCLI/output/WingetCreateCLI.exe ./wingetcreate-${{ matrix.dotnet-runtime }}.exe
- run: dotnet publish ./WingetCreateCLI.csproj -c Release -r linux-x64 --output ./output/linux-x64
working-directory: src/WingetCreateCLI

- run: dotnet publish ./WingetCreateCLI.csproj -c Release -r linux-arm64 --output ./output/linux-arm64
working-directory: src/WingetCreateCLI

- name: Rename binaries according to os and arch
run: |
@('win-x64', 'win-arm64', 'linux-x64', 'linux-arm64') | % {
$wc = get-item -Path .\$_\WingetCreateCLI$(if($_.StartsWith("win")){".exe"})
move-item $wc.fullname ./wingetcreate-$_$(if($_.StartsWith("win")){".exe"})
}
working-directory: src/WingetCreateCLI/output

- name: Delete old release 🗑️
run: |
Expand All @@ -87,6 +77,6 @@ jobs:
name: Nightly release 🌙
tag_name: nightly
draft: false
files: wingetcreate-*
files: src/WingetCreateCLI/output/wingetcreate-*
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
81 changes: 73 additions & 8 deletions pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ variables:
# Appx Package Directory
appxPackageDir: '$(Build.ArtifactStagingDirectory)\AppxPackages'

# Portable executables directory
portableExecutablesDir: '$(Build.ArtifactStagingDirectory)\PortableExecutables'

# WingetCreate Msix Bundle Directory
wingetCreatePackageDir: '$(appxPackageDir)\WingetCreateMsixBundle'

Expand All @@ -34,14 +37,14 @@ variables:
buildPlatform: "x64"

# Target framework
targetFramework: "net6.0-windows10.0.22000.0"
targetFramework: "net8.0-windows10.0.26100.0"

resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
Expand All @@ -51,7 +54,7 @@ extends:
image: windows-2022
os: windows
customBuildTags:
- ES365AIMigrationTooling
- ES365AIMigrationTooling
settings:
skipBuildTagsForGitHubPullRequests: true

Expand Down Expand Up @@ -91,6 +94,7 @@ extends:
steps:
- checkout: self
lfs: "true"
submodules: true

- task: PowerShell@2
displayName: Display version and bundle path for diagnosing
Expand All @@ -117,23 +121,84 @@ extends:
nugetConfigPath: "NuGet.config"
projects: $(workingDirectory)/**/*.csproj

- displayName: "Setup Rust, Zig"
pwsh: |
rustup target add aarch64-pc-windows-msvc
rustup target add x86_64-unknown-linux-gnu
rustup target add aaarch64-unknown-linux-gnu
choco install zig
iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
cargo binstall cargo-zigbuild -y
- displayName: Build rust-msi
pwsh: |
cargo build --release --target x86_64-pc-windows-msvc
cargo build --release --target aarch64-pc-windows-msvc
cargo zigbuild --release --target x86_64-unknown-linux-gnu
cargo zigbuild --release --target aarch64-unknown-linux-gnu
workingDirectory: $(workingDirectory)/WingetCreateCore/Common/Msi/rust-msi

- task: MSBuild@1
displayName: Build Solution
inputs:
platform: "$(buildPlatform)"
solution: "$(solution)"
configuration: "$(buildConfiguration)"
msbuildArguments: '/p:AppxBundleOutput="$(appxBundlePath)"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=SideloadOnly
/p:AppxPackageSigningEnabled=false'

- task: DotNetCoreCLI@2
displayName: "Publish (win-x64)"
inputs:
command: "publish"
projects: "WingetCreateCLI.csproj"
arguments: "-c Release -r win-x64 --output ./output/win-x64"
workingDirectory: "$(workingDirectory)/WingetCreateCLI"

- task: DotNetCoreCLI@2
displayName: "Publish (win-arm64)"
inputs:
command: "publish"
projects: "WingetCreateCLI.csproj"
arguments: "-c Release -r win-arm64 --output ./output/win-arm64"
workingDirectory: "$(workingDirectory)/WingetCreateCLI"

- task: DotNetCoreCLI@2
displayName: "Publish (linux-x64)"
inputs:
command: "publish"
projects: "WingetCreateCLI.csproj"
arguments: "-c Release -r linux-x64 --output ./output/linux-x64"
workingDirectory: "$(workingDirectory)/WingetCreateCLI"

- task: DotNetCoreCLI@2
displayName: "Publish (linux-arm64)"
inputs:
command: "publish"
projects: "WingetCreateCLI.csproj"
arguments: "-c Release -r linux-arm64 --output ./output/linux-arm64"
workingDirectory: "$(workingDirectory)/WingetCreateCLI"

- task: 1ES.PublishPipelineArtifact@1
inputs:
targetPath: $(wingetCreatePackageDir)
artifactName: wingetcreate_msixbundle
displayName: Publish WingetCreate msix bundle

- pwsh: |
@('win-x64', 'win-arm64', 'linux-x64', 'linux-arm64') | ForEach-Object {
$wc = get-item ./$_/WingetCreateCLI$(if($_.StartsWith("win")){".exe"})
move-item $wc.fullname $(portableExecutablesDir)\wingetcreate-$_$(if($_.StartsWith("win")){".exe"})
}
workingDirectory: $(workingDirectory)/WingetCreateCLI/output
- task: 1ES.PublishPipelineArtifact@1
inputs:
targetPath: $(portableExecutablesDir)
artifactName: wingetcreate_exes
displayName: Publish WingetCreate executables

- task: ComponentGovernanceComponentDetection@0
displayName: Component Governance
inputs:
Expand Down Expand Up @@ -171,4 +236,4 @@ extends:
testSelector: "testAssemblies"
testAssemblyVer2: 'src\WingetCreateTests\WingetCreateTests\bin\$(buildPlatform)\$(buildConfiguration)\$(targetFramework)\WingetCreateTests.dll'
runSettingsFile: 'src\WingetCreateTests\WingetCreateTests\Test.runsettings'
overrideTestrunParameters: '-WingetPkgsTestRepoOwner microsoft -WingetPkgsTestRepo winget-pkgs-submission-test -GitHubAppPrivateKey "$(GitHubApp_PrivateKey)"'
overrideTestrunParameters: '-WingetPkgsTestRepoOwner microsoft -WingetPkgsTestRepo winget-pkgs-submission-test -GitHubAppPrivateKey "$(GitHubApp_PrivateKey)"'
16 changes: 8 additions & 8 deletions src/WingetCreateCLI/Models/SettingsModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//----------------------
// <auto-generated>
// Generated using the NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org)
// Generated using the NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org)
// </auto-generated>
//----------------------

Expand All @@ -12,7 +12,7 @@ namespace Microsoft.WingetCreateCLI.Models.Settings
/// <summary>
/// Telemetry settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.2.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class Telemetry
{
/// <summary>
Expand All @@ -27,7 +27,7 @@ public partial class Telemetry
/// <summary>
/// Controls the clean up interval of installer cache and logs
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.2.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class CleanUp
{
/// <summary>
Expand All @@ -49,7 +49,7 @@ public partial class CleanUp
/// <summary>
/// Windows Package Manager Repository settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.2.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class WindowsPackageManagerRepository
{
/// <summary>
Expand All @@ -70,7 +70,7 @@ public partial class WindowsPackageManagerRepository
/// <summary>
/// Output manifest settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.2.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class Manifest
{
/// <summary>
Expand All @@ -86,7 +86,7 @@ public partial class Manifest
/// <summary>
/// Visual settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.2.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class Visual
{
/// <summary>
Expand All @@ -98,7 +98,7 @@ public partial class Visual

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.2.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class SettingsManifest
{
/// <summary>
Expand Down Expand Up @@ -130,7 +130,7 @@ public partial class SettingsManifest

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.2.0 (Newtonsoft.Json v13.0.0.0)")]
public enum ManifestFormat
{

Expand Down
6 changes: 3 additions & 3 deletions src/WingetCreateCore/WingetCreateCore.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down Expand Up @@ -94,11 +94,11 @@
<Exec Command="cargo build --release --target aarch64-pc-windows-msvc --manifest-path $(ProjectDir)Common\Msi\rust-msi\Cargo.toml" />
</Target>
<Target Name="CargoBuild_linux_x86_64" Condition="'$(IsLinux)'=='true' And '$(IsX64)'=='true'" BeforeTargets="PreBuild;PreBuildEvent">
<Message Importance="high" Text="Running: cargo build --release --target x86_64-unknown-linux-gnu --manifest-path $(ProjectDir)Common\Msi\rust-msi\Cargo.toml" />
<Message Importance="high" Text="Running: cargo zigbuild --release --target x86_64-unknown-linux-gnu --manifest-path $(ProjectDir)Common\Msi\rust-msi\Cargo.toml" />
<Exec Command="cargo zigbuild --release --target x86_64-unknown-linux-gnu --manifest-path $(ProjectDir)Common\Msi\rust-msi\Cargo.toml" />
</Target>
<Target Name="CargoBuild_linux_arm64" Condition="'$(IsLinux)'=='true' And '$(IsArm64)'=='true'" BeforeTargets="PreBuild;PreBuildEvent">
<Message Importance="high" Text="Running: cargo build --release --target aarch64-unknown-linux-gnu --manifest-path $(ProjectDir)Common\Msi\rust-msi\Cargo.toml" />
<Message Importance="high" Text="Running: cargo zigbuild --release --target aarch64-unknown-linux-gnu --manifest-path $(ProjectDir)Common\Msi\rust-msi\Cargo.toml" />
<Exec Command="cargo zigbuild --release --target aarch64-unknown-linux-gnu --manifest-path $(ProjectDir)Common\Msi\rust-msi\Cargo.toml" />
</Target>

Expand Down

0 comments on commit 3e66622

Please sign in to comment.