Skip to content

Commit

Permalink
Merge bcd730c into 9f244d0
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster committed Jun 26, 2021
2 parents 9f244d0 + bcd730c commit cfb2396
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 65 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Tinyphone Build

on:
workflow_dispatch:
release:
pull_request:
types:
- labeled
branches:
- master

jobs:
tinyphone_win_job:
if: github.event.label.name == 'ci/github' || github.event_name == 'workflow_dispatch' || github.event_name == 'release'
name: Build Tinyphone Windows
runs-on: windows-2016
steps:
- name: Checkout
uses: actions/checkout@v2
# - name: Cache Docker layers
# uses: actions/cache@v2
# with:
# path: "C:\buildx-cache"
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.GH_TOKEN }}
- name: Get Changed Files
uses: jitterbit/get-changed-files@v1
id: changed_files
with:
format: 'space-delimited'
- name: Set vars
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Build and Push tinyphone_base to registry
if: contains(steps.changed_files.outputs.modified, 'Dockerfile.base')
run: |
docker build --file=./distribution/docker/Dockerfile.base -t ghcr.io/${{ github.repository_owner }}/tinyphone_base:latest -t ghcr.io/${{ github.repository_owner }}/tinyphone_base:${{ steps.vars.outputs.sha_short }} ./distribution/docker
docker push ghcr.io/${{ github.repository_owner }}/tinyphone_base:latest
docker push ghcr.io/${{ github.repository_owner }}/tinyphone_base:${{ steps.vars.outputs.sha_short }}
- name: Build tinyphone
run: |
cat ./distribution/docker/release.ps1 | docker run -v ${PWD}:"C:\Code\tinyphone" -i ghcr.io/${{ github.repository_owner }}/tinyphone_base:latest
# docker cp $(docker ps -a --last 1 -q):"C:\Code\tinyphone\tinyphone-installer\bin\Release\tinyphone_installer.msi" "tinyphone_installer.$(date +%s).msi"
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: tinyphone_installer
path: |
./tinyphone-installer/bin/Release/tinyphone_installer.msi
- name: Create Release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
artifacts: "./tinyphone/Release/tinyphone.exe,tinyphone-installer/bin/Release/tinyphone_installer.msi"
draft: true
allowUpdates: true
token: ${{ secrets.GH_TOKEN }}
40 changes: 20 additions & 20 deletions distribution/docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# escape=`

FROM microsoft/dotnet-framework:3.5-windowsservercore-ltsc2016
FROM mcr.microsoft.com/dotnet/framework/runtime:3.5-windowsservercore-ltsc2016
MAINTAINER Kinshuk B (hi@kinsh.uk)

RUN mkdir C:\BuildTools
RUN powershell.exe mkdir C:\BuildTools

# Reset the shell.
SHELL ["cmd", "/S", "/C"]
Expand All @@ -17,51 +16,52 @@ ADD https://download.microsoft.com/download/E/E/D/EEDF18A8-4AED-4CE0-BEBE-70A830
RUN start /wait C:\TEMP\msbuild14.exe /q /full /log C:\TEMP\msbuild14.log

# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/15/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman
ADD https://aka.ms/vs/15/release/channel C:\TEMP\VisualStudio.chman

# Download and install Build Tools for Visual Studio 2017 for native desktop workload.
ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--channelUri C:\TEMP\VisualStudio.chman `
--installChannelUri C:\TEMP\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended`
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended `
--add Microsoft.Component.MSBuild `
--add Microsoft.VisualStudio.Component.VC.140 `
--add Microsoft.VisualStudio.Component.WinXP `
# --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
# --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
# --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
# --remove Microsoft.VisualStudio.Component.Windows81SDK `
--installPath C:\BuildTools

# Verify if .NET isn't broken (bug with the ltsc2016 docker image)
# RUN powershell.exe -Command echo Everything is OK

# Install Scoop
RUN powershell.exe -ExecutionPolicy RemoteSigned `
iex (new-object net.webclient).downloadstring('https://get.scoop.sh');
RUN powershell.exe [Net.ServicePointManager]::SecurityProtocol =[Net.SecurityProtocolType]::Tls12 ; Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh');

# Install Git & other tools
RUN powershell.exe scoop install git wget cmake openssh unzip make

RUN powershell.exe [environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')
RUN powershell.exe scoop install git curl wget cmake win32-openssh unzip make;
RUN powershell.exe [environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER');

ADD https://dl.bintray.com/boostorg/release/1.68.0/binaries/boost_1_68_0-msvc-14.0-32.exe C:\TEMP\boost_1_68_0-msvc-14.0-32.exe
RUN C:\TEMP\boost_1_68_0-msvc-14.0-32.exe /SILENT
ADD https://boost.teeks99.com/bin/1.68.0/boost_1_68_0-msvc-14.0-32.exe C:\TEMP\boost_1_68_0-msvc-14.0-32.exe
RUN cmd.exe /c C:\TEMP\boost_1_68_0-msvc-14.0-32.exe /SILENT

ADD https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311.exe C:\TEMP\wix311.exe
RUN C:\TEMP\Install.cmd C:\TEMP\wix311.exe /install /quiet /norestart
RUN powershell.exe C:\TEMP\Install.cmd C:\TEMP\wix311.exe /install /quiet /norestart

RUN mkdir C:\Code

# fix for paste issue https://github.com/moby/moby/issues/29646#issuecomment-300483809
WORKDIR "Program Files"
RUN rd /S /Q WindowsPowerShell\Modules\PSReadLine

#subst E: C:\Code\tinyphone
#WORKDIR "Program Files"
RUN powershell.exe Remove-Item -LiteralPath 'C:\Program Files\WindowsPowerShell\Modules\PSReadLine' -Force -Recurse

WORKDIR C:\BuildTools


ADD VsDevCmdPowerShell.bat C:\BuildTools\
ENTRYPOINT C:\BuildTools\VsDevCmdPowerShell.bat

# Start developer command prompt with any other commands specified.
# ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat &&

# Default to PowerShell if no other command specified.
# CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
# CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
31 changes: 0 additions & 31 deletions distribution/docker/Dockerfile.build

This file was deleted.

7 changes: 3 additions & 4 deletions distribution/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
## Build Docker Image

```
docker build -f Dockerfile.base -m 2G -t dotnet3.5-vs17:latest .
docker build -f Dockerfile.build -m 2G -t tinyphone .
docker build -f Dockerfile.base -m 2G -t tinyphone_base .
```

## Run Docker
## Run Docker Build

```
./release.sh
cat release.ps1 | docker run -v `pwd`:"C:\Code\tinyphone" -i tinyphone_base
```
16 changes: 11 additions & 5 deletions distribution/docker/release.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# Build Script...
$ErrorActionPreference="Stop"
$BuildMode="Release"

git config --global url.https://github.com/.insteadOf git@github.com:

Write-Host 'Building Tinyphone!'
#cd C:\Code


cd C:\Code

git config --global url.https://github.com/.insteadOf git@github.com:
git clone --recurse-submodules -j8 https://github.com/voiceip/tinyphone.git
cd C:\Code\tinyphone\
# git checkout docker

Write-Host "Updating Submodules......"
git submodule -q update --init

# git apply C:\Build\fk.patch


Expand Down Expand Up @@ -60,9 +61,14 @@ msbuild /m statsd-cpp.vcxproj /p:Configuration=$BuildMode /p:Platform=Win32

#ls E:\lib\curl\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl
cd E:\tinyphone
sed -i 's/stampver.inf.*\$/stampver.inf $/g' tinyphone.vcxproj

#msbuild /m tinyphone.sln -target:tinyphone /p:Configuration=$BuildMode /p:Platform=x86
#msbuild /m tinyphone.sln -target:tinyphone:Rebuild /p:Configuration=$BuildMode /p:Platform=x86
msbuild /m tinyphone.sln /p:Configuration=$BuildMode /p:Platform=x86


#required for github-ci permission issue.
cmd /c icacls E:/tinyphone-installer/bin/Release/tinyphone_installer.msi /grant everyone:f

#git diff --exit-code stampver.inf
9 changes: 4 additions & 5 deletions distribution/docker/release.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
set -e

docker build -m 2G -f Dockerfile.build -t tinyphone .
docker build -m 8G -f distribution/docker/Dockerfile.base -t tinyphone_base ./distribution/docker
#docker run -m 2G tinyphone:latest "C:\Build\release.ps1"
cat release.ps1 | docker run -m 2G -i tinyphone
cat release.ps1 | docker run -v `pwd`:"C:\Code\tinyphone" -i tinyphone_base

docker cp $(docker ps -a --last 1 -q):"C:\Code\tinyphone\tinyphone-installer\bin\Release\tinyphone_installer.msi" "tinyphone_installer.$(date +%s).msi"

docker rmi $(docker ps -a --last 1 -q)
# docker cp $(docker ps -a --last 1 -q):"C:\Code\tinyphone\tinyphone-installer\bin\Release\tinyphone_installer.msi" "tinyphone_installer.$(date +%s).msi"
# docker rmi $(docker ps -a --last 1 -q)

0 comments on commit cfb2396

Please sign in to comment.