forked from masesgroup/DDMChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
masesgroup#11: added scripts for CI/CD
- Loading branch information
1 parent
a4a1d9b
commit 19d7ac2
Showing
5 changed files
with
252 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI_BUILD | ||
|
||
# Controls when the action will run. Triggers the workflow on push | ||
# events but only for the master branch | ||
on: | ||
push: | ||
|
||
# This workflow contains two jobs called "check_changes", "build_windows" | ||
jobs: | ||
# Verify if a build is needed | ||
check_changes: | ||
name: Check changed files | ||
outputs: | ||
run_build_windows: ${{ steps.check_files.outputs.run_build_windows }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: get_changed_files | ||
uses: jitterbit/get-changed-files@v1 | ||
with: | ||
format: 'csv' | ||
- id: check_files | ||
run: | | ||
mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.get_changed_files.outputs.added_modified }}') | ||
for added_modified_file in "${added_modified_files[@]}"; do | ||
if [[ $added_modified_file == ".github/workflows/build.yaml"* ]]; then | ||
echo "$added_modified_file is myself." | ||
echo "::set-output name=run_build_windows::true" | ||
break | ||
fi | ||
if [[ $added_modified_file == "src/"* ]]; then | ||
echo "$added_modified_file file is under the directory 'src/'." | ||
echo "::set-output name=run_build_windows::true" | ||
break | ||
fi | ||
done | ||
- name: Get run_build_windows | ||
run: echo "The selected run_build_windows is ${{ steps.check_files.outputs.run_build_windows }}" | ||
|
||
# Now run "build_windows" | ||
build_windows: | ||
needs: check_changes | ||
if: "always() && needs.check_changes.outputs.run_build_windows == 'true'" | ||
# The type of runner that the job will run on | ||
runs-on: windows-2019 | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Runs a set of commands using the runners shell | ||
# Support longpaths | ||
- name: Support long paths | ||
run: git config --system core.longpaths true | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: set up msvc env | ||
uses: ilammy/[email protected] | ||
|
||
- name: Build Common Tools | ||
shell: cmd | ||
run: | | ||
cd third_party\CommonTools | ||
msbuild -p:Configuration=Release,Platform="Any CPU" -m CommonTools.sln | ||
- name: Extract commit SHA | ||
run: | | ||
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Prepare version | ||
shell: cmd | ||
run: | | ||
cd third_party\CommonTools\Output | ||
VersionGenerator %GITHUB_WORKSPACE%\src\ProductInformation\Version.cs %GITHUB_WORKSPACE%\src\ProductInformation ${{ env.GITHUB_COMMIT_MESSAGE }} | ||
env: | ||
GITHUB_WORKSPACE: $GITHUB_WORKSPACE | ||
|
||
- name: Build Chat net4.7.2, net5.0 and netcoreapp3.1 | ||
run: | | ||
dotnet build --no-incremental --configuration Release --framework netcoreapp3.1 -o Outputnetcoreapp31 src\ChatCore.sln | ||
dotnet build --no-incremental --configuration Release --framework net5.0-windows -o Outputnet50 src\ChatCore.sln | ||
dotnet build --no-incremental --configuration Release --framework net472 -o Outputnet472 src\ChatCore.sln | ||
- name: Prepare for packaging | ||
run: | | ||
Compress-Archive -Path .\Outputnetcoreapp31\* -DestinationPath .\netcoreapp31.zip | ||
Compress-Archive -Path .\Outputnet50\* -DestinationPath .\net50.zip | ||
Compress-Archive -Path .\Outputnet472\* -DestinationPath .\net472.zip | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: netcoreapp31 | ||
path: .\netcoreapp31.zip | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: net50 | ||
path: .\net50.zip | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: net472 | ||
path: .\net472.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI_PULLREQUEST | ||
|
||
# Controls when the action will run. Triggers the workflow on pull request | ||
# events but only for the master branch | ||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
# This workflow contains a single job called "build_release" | ||
build_pullrequest: | ||
# The type of runner that the job will run on | ||
runs-on: windows-2019 | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Runs a set of commands using the runners shell | ||
# Support longpaths | ||
- name: Support long paths | ||
run: git config --system core.longpaths true | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: set up msvc env | ||
uses: ilammy/[email protected] | ||
|
||
- name: Build Common Tools | ||
shell: cmd | ||
run: | | ||
cd third_party\CommonTools | ||
msbuild -p:Configuration=Release,Platform="Any CPU" -m CommonTools.sln | ||
- name: Extract commit SHA | ||
run: | | ||
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Prepare version | ||
shell: cmd | ||
run: | | ||
cd third_party\CommonTools\Output | ||
VersionGenerator %GITHUB_WORKSPACE%\src\ProductInformation\Version.cs %GITHUB_WORKSPACE%\src\ProductInformation ${{ env.GITHUB_COMMIT_MESSAGE }} | ||
env: | ||
GITHUB_WORKSPACE: $GITHUB_WORKSPACE | ||
|
||
- name: Build Chat net4.7.2, net5.0 and netcoreapp3.1 | ||
run: | | ||
dotnet build --no-incremental --configuration Release --framework netcoreapp3.1 -o Outputnetcoreapp31 src\ChatCore.sln | ||
dotnet build --no-incremental --configuration Release --framework net5.0-windows -o Outputnet50 src\ChatCore.sln | ||
dotnet build --no-incremental --configuration Release --framework net472 -o Outputnet472 src\ChatCore.sln |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI_RELEASE | ||
|
||
# Controls when the action will run. Triggers the workflow on release published or release edited request | ||
# events but only for the master branch | ||
on: | ||
release: | ||
types: | ||
- published | ||
- edited | ||
|
||
jobs: | ||
# This workflow contains a single job called "build_release" | ||
build_release: | ||
# The type of runner that the job will run on | ||
runs-on: windows-2019 | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Runs a set of commands using the runners shell | ||
# Support longpaths | ||
- name: Support long paths | ||
run: git config --system core.longpaths true | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: set up msvc env | ||
uses: ilammy/[email protected] | ||
|
||
- name: Build Common Tools | ||
shell: cmd | ||
run: | | ||
cd third_party\CommonTools | ||
msbuild -p:Configuration=Release,Platform="Any CPU" -m CommonTools.sln | ||
- name: Extract commit SHA | ||
run: | | ||
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Prepare version | ||
shell: cmd | ||
run: | | ||
cd third_party\CommonTools\Output | ||
VersionGenerator %GITHUB_WORKSPACE%\src\ProductInformation\Version.cs %GITHUB_WORKSPACE%\src\ProductInformation ${{ env.GITHUB_COMMIT_MESSAGE }} | ||
env: | ||
GITHUB_WORKSPACE: $GITHUB_WORKSPACE | ||
|
||
- name: Build Chat net4.7.2, net5.0 and netcoreapp3.1 | ||
run: | | ||
dotnet build --no-incremental --configuration Release --framework netcoreapp3.1 -o Outputnetcoreapp31 src\ChatCore.sln | ||
dotnet build --no-incremental --configuration Release --framework net5.0-windows -o Outputnet50 src\ChatCore.sln | ||
dotnet build --no-incremental --configuration Release --framework net472 -o Outputnet472 src\ChatCore.sln | ||
- name: Prepare for packaging | ||
run: | | ||
Compress-Archive -Path .\Outputnetcoreapp31\* -DestinationPath .\netcoreapp31.zip | ||
Compress-Archive -Path .\Outputnet50\* -DestinationPath .\net50.zip | ||
Compress-Archive -Path .\Outputnet472\* -DestinationPath .\net472.zip | ||
- name: Upload netcoreapp31 Chat binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: .\netcoreapp31.zip | ||
asset_name: netcoreapp31 | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
|
||
- name: Upload net50 Chat binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: .\net50.zip | ||
asset_name: net50 | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
|
||
- name: Upload net472 Chat binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: .\net472.zip | ||
asset_name: net472 | ||
tag: ${{ github.ref }} | ||
overwrite: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters