Skip to content

Commit

Permalink
Add GitHub Actions Support
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jun 22, 2022
1 parent 2ca2a10 commit 92a8a17
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 6 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Disabled cos we do not have enough disk space.
# build_windows:
# name: BuildWindows
# # The type of runner that the job will run on
# runs-on: windows-latest

# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# fetch-depth: 0
# - name: Install .NET
# uses: actions/setup-dotnet@v2
# with:
# dotnet-version: |
# 6.0.x
# 7.0.x
# include-prerelease: true

# - name: Build
# run: .\build.cmd
# env:
# CONFIGURATION: Release
# PREPARE_CI: 1
# PREPARE_AUTOPROVISION: 1

# Disabled cos it times out and there are diskspace issues.
# build_unix:
# name: BuildUnix
# # The type of runner that the job will run on
# runs-on: ubuntu-latest

# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# fetch-depth: 0
# - name: Install .NET
# uses: actions/setup-dotnet@v2
# with:
# dotnet-version: |
# 6.0.x
# 7.0.x
# include-prerelease: true

# - name: Build
# run: ./build.sh
# env:
# CONFIGURATION: Release
# PREPARE_CI: 1
# PREPARE_AUTOPROVISION: 1

# - name: Create Installers
# run: make package-deb
# env:
# CONFIGURATION: Release
# PREPARE_CI: 1
# PREPARE_AUTOPROVISION: 1

build_macos:
name: BuildMacOS
# The type of runner that the job will run on
runs-on: macos-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0 # we need this to get the full history so we can calculate the version info.
- name: Install .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true

- name: Prepare
run: ./build.sh Prepare
env:
CONFIGURATION: Release
PREPARE_CI: 1
PREPARE_AUTOPROVISION: 1

- name: Build
run: ./build.sh Build
env:
CONFIGURATION: Release
PREPARE_CI: 1
PREPARE_AUTOPROVISION: 1

- name: Create Installers
run: ./build.sh Installers
env:
CONFIGURATION: Release
PREPARE_CI: 1
PREPARE_AUTOPROVISION: 1

- name: Create Release
id: create-release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./bin/BuildRelease/Xamarin.Android.Sdk-OSS*


Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override bool Execute ()
// HEAD -> bundle-ndk16-fix, origin/pr/1105
//
branch = branchFull.Substring (8);
} else if (String.Compare ("HEAD", branchFull, StringComparison.Ordinal) == 0) {
} else if (String.Compare ("HEAD", branchFull, StringComparison.Ordinal) == 0 || branchFull.StartsWith ("grafted", StringComparison.Ordinal)) {
Log.LogMessage (MessageImportance.Low, " Detached HEAD, no branch information");
// Detached HEAD without branch information
if (isSubmodule) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ protected override string GenerateCommandLineCommands ()
string endCommit = string.IsNullOrEmpty (EndCommit)
? "HEAD"
: EndCommit;
if (StartCommit.StartsWith ("^"))
return $"log {StartCommit.Trim('^')} --oneline";
return $"log {StartCommit}..{endCommit} --oneline";
}

Expand Down
2 changes: 2 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ IF ERRORLEVEL 1 CALL :DEFAULT_CASE
:Pack_CASE
dotnet-local.cmd build Xamarin.Android.sln -t:PackDotNet -nr:false
GOTO END_CASE
:Installers_CASE
GOTO END_CASE
:DEFAULT_CASE
dotnet build Xamarin.Android.sln -t:Prepare -nr:false
dotnet-local.cmd build Xamarin.Android.sln -nr:false
Expand Down
8 changes: 3 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@ else
case $1 in
Prepare)
make prepare
break
;;
PrepareExternal)
make prepare-external-git-dependencies
break
;;
Build)
make jenkins
break
;;
Pack)
make pack-dotnet
break
;;
Installers)
make create-installers
;;
Everything)
make prepare && make jenkins && make pack-dotnet
break
;;
esac
fi

0 comments on commit 92a8a17

Please sign in to comment.