Skip to content

Commit

Permalink
add CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
nigriMSFT committed Apr 16, 2024
1 parent 8659faf commit e110b84
Show file tree
Hide file tree
Showing 5 changed files with 372 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "saturday"
88 changes: 88 additions & 0 deletions .github/workflows/build-reuse-unix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build Unix

# The caller is responsible for making sure all options passed to this workflow are valid and compatible with each other.

on:
workflow_call:
inputs:
ref:
required: false
default: ''
type: string
config:
required: false
default: 'Release'
type: string
# options:
# - Debug
# - Release
plat:
required: false
type: string
default: 'linux'
# options:
# - linux
# - android
# - ios
# - macos
os:
required: false
type: string
default: 'ubuntu-20.04'
# options:
# - ubuntu-20.04
# - ubuntu-22.04
# - macos-12
arch:
required: false
default: 'x64'
type: string
# options:
# - x86
# - x64
# - arm
# - arm64
static:
required: false
default: ''
type: string
clang:
required: false
default: ''
type: string
build:
required: false
default: '' # Empty string means build all
type: string

permissions: read-all

jobs:
build-unix-reuse:
name: Build
runs-on: ${{ inputs.os }}
container:
image: ${{ inputs.plat == 'linux' && format('ghcr.io/microsoft/msquic/linux-build-xcomp:{0}', inputs.os) || '' }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
repository: microsoft/cxplat
ref: ${{ inputs.ref }}
- name: Set ownership
if: inputs.plat == 'linux'
run: |
# this is to fix GIT not liking owner of the checkout dir
chown -R $(id -u):$(id -g) $PWD
- name: Prepare Machine
shell: pwsh
run: scripts/prepare-machine.ps1 -ForBuild
- name: Build
if: inputs.build == ''
shell: pwsh
run: scripts/build.ps1 -Config ${{ inputs.config }} -Platform ${{ inputs.plat }} -Arch ${{ inputs.arch }} ${{ inputs.static }} ${{ inputs.clang }} -OneBranch
- name: Upload build artifacts
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: ${{ inputs.config }}-${{ inputs.plat }}-${{ inputs.os }}-${{ inputs.arch }}-${{ inputs.static }}${{ inputs.clang }}${{ inputs.build }}
path: artifacts
75 changes: 75 additions & 0 deletions .github/workflows/build-reuse-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build WinUser

# The caller is responsible for making sure all options passed to this workflow are valid and compatible with each other.

on:
workflow_call:
inputs:
ref:
required: false
default: ''
type: string
config:
required: false
default: 'Release'
type: string
# options:
# - Debug
# - Release
plat:
required: false
type: string
default: 'windows'
# options:
# - windows
# - uwp
# - winkernel
os:
required: false
type: string
default: 'windows-2019'
# options:
# - windows-2019
# - windows-2022
arch:
required: false
default: 'x64'
type: string
# options:
# - x86
# - x64
# - arm64
static:
required: false
default: ''
type: string
build:
required: false
default: '' # Empty string means build all
type: string

permissions: read-all

jobs:
build-windows-reuse:
if: inputs.plat == 'windows' || inputs.plat == 'uwp'
name: Build
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
repository: microsoft/cxplat
ref: ${{ inputs.ref }}
- name: Prepare Machine
shell: pwsh
run: scripts/prepare-machine.ps1 -ForBuild
- name: Build
if: inputs.build == ''
shell: pwsh
run: scripts/build.ps1 -Config ${{ inputs.config }} -Platform ${{ inputs.plat }} -Arch ${{ inputs.arch }} ${{ inputs.static }}
- name: Upload build artifacts
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: ${{ inputs.config }}-${{ inputs.plat }}-${{ inputs.os }}-${{ inputs.arch }}-${{ inputs.static }}${{ inputs.build }}
path: artifacts
73 changes: 73 additions & 0 deletions .github/workflows/build-reuse-winkernel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build WinKernel

# The caller is responsible for making sure all options passed to this workflow are valid and compatible with each other.

on:
workflow_call:
inputs:
ref:
required: false
default: ''
type: string
config:
required: false
default: 'Release'
type: string
# options:
# - Debug
# - Release
plat:
required: false
type: string
default: 'winkernel'
# options:
# - winkernel
os:
required: false
type: string
default: 'windows-2019'
# options:
# - windows-2019
# - windows-2022
arch:
required: false
default: 'x64'
type: string
# options:
# - x86
# - x64
# - arm64
build:
required: false
default: '' # Empty string means build all
type: string

permissions: read-all

jobs:
build-windows-kernel-reuse:
name: Build
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
repository: microsoft/cxplat
ref: ${{ inputs.ref }}
- name: Prepare Machine
shell: pwsh
run: scripts/prepare-machine.ps1 -ForBuild
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce
- name: Nuget Restore
shell: pwsh
run: msbuild cxplat.kernel.sln -t:restore /p:RestorePackagesConfig=true /p:Configuration=${{ inputs.config }} /p:Platform=${{ inputs.arch }}
- name: Build
if: inputs.build == ''
shell: pwsh
run: msbuild cxplat.kernel.sln /m /p:Configuration=${{ inputs.config }} /p:Platform=${{ inputs.arch }} /p:CXPLAT_VER_SUFFIX=-official
- name: Upload build artifacts
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: ${{ inputs.config }}-${{ inputs.plat }}-${{ inputs.os }}-${{ inputs.arch }}-${{ inputs.build }}
path: artifacts
127 changes: 127 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Build

on:
workflow_dispatch:
push:
branches:
- main
- release/*
pull_request:
branches:
- main
- release/*

concurrency:
# Cancel any workflow currently in progress for the same PR.
# Allow running concurrently with any other commits.
group: build-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

permissions: read-all

jobs:
build-windows:
name: WinUser
needs: []
strategy:
fail-fast: false
matrix:
config: ['Debug', 'Release']
plat: [windows, uwp] # TODO: Support gamecore_console
os: ['windows-2022']
arch: [x86, x64, arm64]
static: ['', '-Static']
exclude:
# TODO: FIX: Static builds fail with UWP
- plat: uwp
static: '-Static'
uses: ./.github/workflows/build-reuse-win.yml
with:
config: ${{ matrix.config }}
plat: ${{ matrix.plat }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
static: ${{ matrix.static }}

build-windows-kernel:
name: WinKernel
needs: []
strategy:
fail-fast: false
matrix:
config: ['Debug', 'Release']
plat: [winkernel]
os: ['windows-2022']
arch: [x64, arm64]
uses: ./.github/workflows/build-reuse-winkernel.yml
with:
config: ${{ matrix.config }}
plat: ${{ matrix.plat }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}

build-ubuntu-cross-compile:
name: UbuntuArm
needs: []
strategy:
fail-fast: false
matrix:
config: ['Debug', 'Release']
plat: [linux]
os: ['ubuntu-20.04', 'ubuntu-22.04']
arch: [arm, arm64]
static: ['', '-Static']
uses: ./.github/workflows/build-reuse-unix.yml
with:
config: ${{ matrix.config }}
plat: ${{ matrix.plat }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
static: ${{ matrix.static }}

build-ubuntu:
name: Ubuntu
needs: []
strategy:
fail-fast: false
matrix:
config: ['Debug', 'Release']
plat: [linux, android]
os: ['ubuntu-20.04', 'ubuntu-22.04']
arch: [x86, x64]
static: ['', '-Static']
clang: ['', '-Clang']
exclude:
# Android doesn't support x86
- plat: android
arch: x86
# Android doesn't use Clang
- plat: android
clang: '-Clang'
uses: ./.github/workflows/build-reuse-unix.yml
with:
config: ${{ matrix.config }}
plat: ${{ matrix.plat }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
static: ${{ matrix.static }}
clang: ${{ matrix.clang }}

build-darwin:
name: MacOs
needs: []
strategy:
fail-fast: false
matrix:
config: ['Debug', 'Release']
plat: [macos, ios]
os: ['macos-12']
arch: [x64, arm64]
static: ['', '-Static']
uses: ./.github/workflows/build-reuse-unix.yml
with:
config: ${{ matrix.config }}
plat: ${{ matrix.plat }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
static: ${{ matrix.static }}

0 comments on commit e110b84

Please sign in to comment.