Skip to content

Commit 02fffcf

Browse files
authored
Enable GitHub PR flow (#2)
Enable GitHub PR flow: * add build orchestration using 'dotnet run' * add CI.yaml to be used for PR and merges to master * runs on agents: windows-latest and macos-latest * create nuget pkg on windows, macOS agents * 4 out of 15 tests do not pass yet on non-windows OS, e.g. WSL/Ubuntu LTS * add gitattributes to normalize line endings and LFS config for binaries
1 parent 8271388 commit 02fffcf

16 files changed

+360
-38
lines changed

.editorconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# see https://aka.ms/editorconfigdocs
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
insert_final_newline = true
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
10+
[*.{json,js}]
11+
indent_size = 2
12+
tab_width = 2
13+
14+
[*.{cake,csproj,ps1,psd1,psm1,editorconfig}]
15+
indent_size = 4
16+
tab_width = 4
17+
18+
[*.sh]
19+
end_of_line = lf
20+
indent_size = 2

.gitattributes

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Set default behavior to automatically normalize line endings.
2+
* text=auto
3+
4+
# win scripts
5+
*.{cmd,[cC][mM][dD]} text eol=crlf
6+
*.{bat,[bB][aA][tT]} text eol=crlf
7+
8+
# linux/macOS scripts
9+
*.sh text eol=lf
10+
11+
# Archives
12+
*.7z filter=lfs diff=lfs merge=lfs -text
13+
*.br filter=lfs diff=lfs merge=lfs -text
14+
*.gz filter=lfs diff=lfs merge=lfs -text
15+
*.msapp filter=lfs diff=lfs merge=lfs -text
16+
*.tar filter=lfs diff=lfs merge=lfs -text
17+
*.zip filter=lfs diff=lfs merge=lfs -text
18+
19+
# Documents
20+
*.pdf filter=lfs diff=lfs merge=lfs -text
21+
*.docx filter=lfs diff=lfs merge=lfs -text
22+
23+
# Images
24+
*.gif filter=lfs diff=lfs merge=lfs -text
25+
*.ico filter=lfs diff=lfs merge=lfs -text
26+
*.jpg filter=lfs diff=lfs merge=lfs -text
27+
*.pdf filter=lfs diff=lfs merge=lfs -text
28+
*.png filter=lfs diff=lfs merge=lfs -text
29+
*.psd filter=lfs diff=lfs merge=lfs -text
30+
*.webp filter=lfs diff=lfs merge=lfs -text
31+
32+
# Fonts
33+
*.woff2 filter=lfs diff=lfs merge=lfs -text
34+
35+
# Other
36+
*.exe filter=lfs diff=lfs merge=lfs -text

.github/workflows/CI.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# CI workflow for PRs and merges to master
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
## TODO: linux-latest complains about not finding/reading the .sln file; works on macOS ??
16+
os: [windows-latest, macos-latest]
17+
env:
18+
DOTNET_NOLOGO: true
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
lfs: true
24+
25+
- uses: actions/setup-dotnet@v1
26+
with:
27+
dotnet-version: '3.1.x'
28+
29+
- run: dotnet --info
30+
31+
- name: Build and test (win)
32+
run: ./build ci
33+
if: ${{ runner.os == 'Windows' }}
34+
35+
- name: Build only (!win)
36+
run: |
37+
./build rebuild
38+
./build pack
39+
# 4 out of 15 tests fail when running on e.g. linux (WSL-Ubuntu LTS) and macOS
40+
if: ${{ runner.os != 'Windows' }}

.vscode/extensions.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"davidanson.vscode-markdownlint",
5+
"eamodio.gitlens",
6+
"ms-azure-devops.azure-pipelines",
7+
"ms-vscode.csharp"
8+
]
9+
}

.vscode/launch.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"name": "Run build targets",
10+
"type": "coreclr",
11+
"request": "launch",
12+
"preLaunchTask": "build targets",
13+
"program": "${workspaceFolder}/targets/bin/Debug/netcoreapp3.1/targets.dll",
14+
"args": [
15+
"build",
16+
"-c", "release"
17+
],
18+
"cwd": "${workspaceFolder}",
19+
"stopAtEntry": false,
20+
"console": "internalConsole"
21+
}
22+
23+
]
24+
}

.vscode/tasks.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build targets",
6+
"command": "dotnet",
7+
"args": [
8+
"build",
9+
"${workspaceFolder}/targets/targets.csproj"
10+
]
11+
}
12+
]
13+
}

README.md

+43-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

2-
This takes a Canvas App (.msapp file) and converts to and from text files that can be checked into source control.
3-
This is similar to the "SolutionPackager" for CDS.
2+
This takes a Canvas App (.msapp file) and converts to and from text files that can be checked into source control.
3+
This is similar to the "SolutionPackager" for CDS.
44

5-
This aggressively ensures the msapps can faithfully roundtrip - and unpacking will immediately do a sanity test and repack and compare.
5+
This aggressively ensures the msapps can faithfully roundtrip - and unpacking will immediately do a sanity test and repack and compare.
66

77
# File Format
88

9-
This is the resulting folder structure after an extraction:
9+
This is the resulting folder structure after an extraction:
1010

11-
1. \src\ - the control and component files. This contains the sources.
12-
1. CanvasManifest.json - a manifest file. This contains what is normally in the header, properties, and publishInfo.
13-
2. *.json - the raw control.json file.
14-
3. *.pa1 - the scripts extracted from the control.json file.
11+
1. \src\ - the control and component files. This contains the sources.
12+
1. CanvasManifest.json - a manifest file. This contains what is normally in the header, properties, and publishInfo.
13+
2. *.json - the raw control.json file.
14+
3. *.pa1 - the scripts extracted from the control.json file.
1515
1. \other\ - all miscellaneous files needed to recreate the .msapp
16-
1. entropy.json - volatile elements (like timestamps) are extracted to this file. This helps reduce noisy diffs in other files while ensuring that we can still round trip.
16+
1. entropy.json - volatile elements (like timestamps) are extracted to this file. This helps reduce noisy diffs in other files while ensuring that we can still round trip.
1717
2. Holds other files from the msapp, such as what is in \references
18-
1. \DataSources\ - a file per datasource.
18+
1. \DataSources\ - a file per datasource.
1919

2020

2121
# Usage
22-
There is a test console app to drive this. The official way to consume this is through the PowerApps CLI https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/powerapps-cli .
22+
There is a test console app to drive this. The official way to consume this is through the PowerApps CLI https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/powerapps-cli .
2323

2424
```
2525
pasopa.exe -unpack PathToMyApp.msapp FolderToExtractTo
@@ -40,3 +40,35 @@ provided by the bot. You will only need to do this once across all repos using o
4040
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4141
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
4242
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
43+
44+
# Building from source
45+
46+
## Setting up a dev box
47+
48+
For a developer machine (Windows 10, WSL, Linux, macOS), install:
49+
50+
- [git](https://git-scm.com/downloads)
51+
- [dotnet Core SDK v3.1.x (x64)](https://dotnet.microsoft.com/download/dotnet-core/3.1)
52+
- [VS Code](https://code.visualstudio.com/Download)
53+
- if on Windows: [VS2019 (Community edition will do)](https://visualstudio.microsoft.com/downloads/)
54+
Select at least the following workloads:
55+
- .NET Core cross-plat
56+
57+
- recommended VSCode extensions:
58+
- [GitLens (eamodio.gitlens)](https://github.com/eamodio/vscode-gitlens)
59+
- [C# (ms-vscode.csharp)](https://github.com/OmniSharp/omnisharp-vscode)
60+
61+
## Building and running tests
62+
63+
After cloning this repo (https://github.com/microsoft/PowerApps-Language-Tooling), open a terminal/cmd/PS prompt with the
64+
dotnet executable on the path. Check with: ```dotnet --version ```
65+
66+
To build, run tests and produce nuget packages, run this command:
67+
68+
```bash
69+
./build ci
70+
```
71+
72+
To list all build targets, run: ```./build --list-tree```
73+
74+
To see other build help, run: ```./build --help```

build

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
dotnet run --project "./targets/targets.csproj" -- "$@"

build.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@pushd %~dp0
2+
@dotnet run --project "./targets/targets.csproj" -- %*
3+
@popd

scorch

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
git clean -fdx

scorch.cmd

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@if "%_echo%"=="" echo off
2+
pushd "%~dp0"
3+
git clean -fdx -e /src/.vs
4+
popd

src/Directory.Build.props

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<PropertyGroup>
33
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
44
<LangVersion>8.0</LangVersion>
5+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
56
</PropertyGroup>
67

78
<!-- If not otherwise specified, the project is building for Debug -->
@@ -28,7 +29,7 @@
2829
<BinPath Condition=" '$(BinPath)' == '' ">$([System.IO.Path]::GetFullPath('$(SourcePath)..\bin'))</BinPath>
2930
<IntermediatePath Condition=" '$(IntermediatePath)' == '' ">$([System.IO.Path]::GetFullPath('$(SourcePath)..\obj'))\</IntermediatePath>
3031
<RelativeProjectPath>$([MSBuild]::MakeRelative($(SourcePath), $(MSBuildProjectDirectory)))</RelativeProjectPath>
31-
32+
3233
<RootOutputPath>$(BinPath)\$(Configuration)\</RootOutputPath>
3334

3435
<!-- Output path for the project -->

0 commit comments

Comments
 (0)