Skip to content

micro-elements/MicroElements.DevOps

Repository files navigation

MicroElements.DevOps

DevOps scripts for CI and CD

Statuses

License NuGetVersion NuGetDownloads MyGetVersion

Travis AppVeyor Coverage Status

Gitter

Main features

  • Based on CakeBuild
  • Supported OS: Windows, Linux
  • Supported CI: Travis, AppVeyor, Jenkins, any other
  • C# project generation or initialization with CI and CD included
  • Only two files: build.ps1 and build.sh. All other files can be generated
  • No need to maintain your own build scripts
  • You can customize and add own tasks if you need

Getting started

1. Download bootstrap script

Open a new PowerShell window and run the following command.

Invoke-WebRequest https://raw.githubusercontent.com/micro-elements/MicroElements.DevOps/master/resources/build.ps1 -OutFile build.ps1

2. Run Init script

Run target Init

./build.ps1 -Target "Init"

Result

  • generated project
  • generated test project
  • travis.yml
  • appveyor.yml
  • build.ps1
  • build.sh
  • CHANGELOG.md
  • README.md
  • common.props
  • version.props
  • src/Directory.Build.props
  • test/Directory.Build.props
  • stylecop integration
  • Readme statuses generated

3. Project initialization

  • Fill common.props: Description, PackageTags, PackageIconUrl (other attributes was filled autpmatically by init script)

4. Usage

Local build

Run target Default

./build.ps1 -Target "Default"

Travis CI

Add file .travis.yml to project

language: csharp
mono: none
dotnet: 2.1.300
os:
  - linux
before_script:
  - chmod a+x ./build.sh
script:
  - ./build.sh --target=Travis --verbosity=normal

Other CI

Run shell script: ./build.sh --target=Travis

Tasks

Init

Initializes project structure and adds all needed files

Runs:

Default

Builds projects and runs tests

Runs:

Travis

Does versioning, builds projects, runs tests creates and uploads artifacts

Runs:

AppVeyor

Builds, tests and uploads test results to appVeyor

Runs:

CreateProjectStructure

TODO: all tasks

Features

Customize build

add cake.build file in root of your project TODO: samples

Concepts

  • ScriptParam
  • ScriptArgs
  • Value chains
  • Conventions

ScriptParam

  • props
  • get value chain

ScriptArgs

Param Description DefaulValue
SrcDir Sources directory. Contains projects. src