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 f2203ca
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 50 deletions.
73 changes: 31 additions & 42 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,63 +17,52 @@ 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
- 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 .\output\$_\WingetCreateCLI
move-item $wc ..\wingetcreate-$_$(if ($_.StartsWith('win')) { '.exe' })
}
- name: Delete old release 🗑️
run: |
Expand All @@ -87,6 +76,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
- 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
move-item $wc $(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)"'

0 comments on commit f2203ca

Please sign in to comment.