Skip to content

Instantly share code, notes, and snippets.

@Alhadis
Last active August 24, 2022 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alhadis/dd58f69e149b9e7732530b01795cd9e9 to your computer and use it in GitHub Desktop.
Save Alhadis/dd58f69e149b9e7732530b01795cd9e9 to your computer and use it in GitHub Desktop.
AppVeyor Configuration Reference
# -*- tab-width: 4; indent-tabs-mode: nil -*- vim: ts=4 et
# Based on https://www.appveyor.com/docs/appveyor-yml/ (July 19th, 2021)
# Notes:
# - All sections are optional; the most minimalist `appveyor.yml` is an empty file
# - All section names are case-sensitive
# - Section names should be unique on each level
#---------------------------------#
# General configuration #
#---------------------------------#
# Version format
version: 1.0.{build}
# You can use {branch} name in version format too
#version: 1.0.{build}-{branch}
# Branches to build
branches:
# Whitelist
only:
- master
- production
# Blacklist
except:
- gh-pages
# Do not build on tags (GitHub, Bitbucket, GitLab, Gitea)
skip_tags: true
# Start builds on tags only (GitHub, BitBucket, GitLab, Gitea)
skip_non_tags: true
# Skip commits with particular message or from specific user
skip_commits:
message: /Created.*\.(png|jpg|jpeg|bmp|gif)/ # Regex matching commit message
author: John # Commit author's username, name, email or regexp matching one of these
# Include commits with particular message or from specific user
only_commits:
message: /build/ # Start new build if message contains the word "build"
author: jack@company.com # Start new build for commit of user with e-mail jack@company.com
# Skip commits affecting specific files (GitHub only)
#skip_commits:
# files:
# - docs/*
# - '**/*.html'
# Include commits affecting specific files (GitHub only)
#only_commits:
# files:
# - Project-A/
# - Project-B/
# Don't build feature-branches with open pull-requests
skip_branch_with_pr: true
# Maximum number of concurrent jobs for the project
max_jobs: 1
#---------------------------------#
# Environment configuration #
#---------------------------------#
# Build worker image (VM template)
image: Visual Studio 2015
# Scripts run before anything else (including a checkout of the project repository)
init:
- git config --global core.autocrlf input
# Clone directory
clone_folder: c:\projects\myproject
# Fetch repository as ZIP archive (default: "false")
shallow_clone: true
# Set clone depth (default: entire repository history)
clone_depth: 5
# Contents of `etc\hosts` file
hosts:
queue-server: 127.0.0.1
db.server.com: 127.0.0.2
# Environment variables
environment:
my_var1: value1
my_var2: value2
# Example of an encrypted variable (to encrypt data: "Account" -> "Settings" -> "Encrypt YAML")
my_secure_var1:
secure: FW3tJ3fMncxvs58/ifSP7w==
#environment:
# global:
# connection_string: server=12;password=13;
# service_url: https://127.0.0.1:8090
#
# matrix:
# - db: mysql
# provider: mysql
#
# - db: mssql
# provider: mssql
# password:
# secure: $#(JFDA)jQ@#$
# Allow failing jobs
matrix:
allow_failures:
- platform: x86
configuration: Debug
- platform: x64
configuration: Release
# Immediately finish build after a failed job
fast_finish: true
# Exclude configuration from matrix
exclude:
- platform: x86
configuration: Debug
# Build cache for preserving files/folders between builds
cache:
- packages -> **\packages.config
- projectA\libs
- node_modules # Locally-installed NPM modules
- '%LocalAppData%\NuGet\Cache' # NuGet (pre-v3)
- '%LocalAppData%\NuGet\v3-cache' # NuGet (v3+)
# Enable services required for building and testing
services:
- mssql2014 # Start SQL Server 2014 Express
- mssql2014rs # Start SQL Server 2014 Express and Reporting Services
- mssql2012sp1 # Start SQL Server 2012 SP1 Express
- mssql2012sp1rs # Start SQL Server 2012 SP1 Express and Reporting Services
- mssql2008r2sp2 # Start SQL Server 2008 R2 SP2 Express
- mssql2008r2sp2rs # Start SQL Server 2008 R2 SP2 Express and Reporting Services
- mysql # Start MySQL 5.6 service
- postgresql # Start PostgreSQL 9.5 service
- iis # Start IIS
- msmq # Start queuing services
- mongodb # Start MongoDB
# Scripts that run after checking out project's repository
install:
# CMD.EXE (Implicit)
- echo This is batch
# CMD.EXE (Explicit)
- cmd: echo This is batch again
- cmd: set MY_VAR=12345
# PowerShell
- ps: Write-Host 'This is PowerShell'
# Enable patching of `AssemblyInfo.*` files
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: "2.2.{build}"
assembly_file_version: "{version}"
assembly_informational_version: "{version}"
# Patch .NET Core `*.*proj` files
dotnet_csproj:
patch: true
file: '**\*.csproj'
version: '{version}'
version_prefix: '{version}'
package_version: '{version}'
assembly_version: '{version}'
file_version: '{version}'
informational_version: '{version}'
# Automatically register private account and/or project AppVeyor NuGet feeds.
nuget:
account_feed: true
project_feed: true
# Disable publishing of .nupkg artefacts to account/project feeds in pull-request builds
disable_publish_on_pr: true
# Disable publishing of Octopus Deploy .nupkg artefacts to account/project feeds
publish_wap_octopus: true
#---------------------------------#
# Build configuration #
#---------------------------------#
# Build platform (i.e. "x86", "x64", "Any CPU") (optional)
platform: Any CPU
# To add several platforms to build matrix:
#platform:
# - x86
# - Any CPU
# Build configuration (i.e., "Debug", "Release", etc)
configuration: Release
# To add several configurations to build matrix:
#configuration:
# - Debug
# - Release
# Build settings (not to be confused with `before_build` or `after_build`)
# NB: `project` is relative to the original build directory, and therefore not
# influenced by directory changes that may have occurred during .
build:
# Path to Visual Studio solution or project, resolved relative to original build directory
# (i.e., directory changes made during `before_build` scripts have no influence on lookup).
project: MyTestAzureCS.sln
parallel: true # Enable MSBuild parallel builds
publish_wap: true # Package Web Application Projects (WAP) for Web Deploy
publish_wap_xcopy: true # Package Web Application Projects (WAP) for XCopy deployment
publish_wap_beanstalk: true # Package Web Applications for AWS Elastic Beanstalk deployment
publish_wap_octopus: true # Package Web Applications for Octopus deployment
publish_azure_webjob: true # Package Azure WebJobs for Zip Push deployment
publish_azure: true # Package Azure Cloud Service projects and push to artefacts
publish_aspnet_core: true # Package ASP.NET Core projects
publish_core_console: true # Package .NET Core console projects
publish_nuget: true # Package projects with .nuspec files and push to artefacts
publish_nuget_symbols: true # Generate and publish NuGet symbol packages
include_nuget_references: true # Add `-IncludeReferencedProjects` option when packaging NuGet artefacts
# MSBuild verbosity level
verbosity: quiet|minimal|normal|detailed
# Scripts run before build
before_build:
# Custom build logic; replaces automatic MSBuild
build_script:
# Scripts run after build
# NB: Working directory and environment changes persist from previous steps
after_build:
# Scripts run *after* solution is built, but *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud services)
before_package:
# Disable automatic builds
#build: off
#---------------------------------#
# Test configuration #
#---------------------------------#
# Run tests against *only* the selected assemblies and/or categories
test:
assemblies:
only:
- asm1.dll
- asm2.dll
categories:
only:
- UI
- E2E
# Run tests against everything *except* selected assemblies and/or categories
#test:
# assemblies:
# except:
# - asm1.dll
# - asm2.dll
#
# categories:
# except:
# - UI
# - E2E
# Run tests from different categories as separate jobs in parallel
#test:
# categories:
# - A # Category common for all jobs
# - [UI] # 1st job
# - [DAL, BL] # 2nd job
# Scripts run before tests
# NB: Working directory and environment changes persist from earlier steps, such as `before_build`
before_test:
- echo script1
- ps: Write-Host "script1"
# Run custom scripts instead of automatic tests
test_script:
- echo This is my custom test script
# Scripts run after tests
after_test:
# Disable automatic tests
#test: off
#---------------------------------#
# Artefact configuration #
#---------------------------------#
artifacts:
# Push a single file
- path: test.zip
# Push a single file with environment variable in path and "Deployment name" specified
- path: MyProject\bin\$(configuration)
name: myapp
# Push entire folder as a ZIP archive
- path: logs
# Recursively push every `.nupkg` file within build directory
- path: '**\*.nupkg'
#---------------------------------#
# Deployment configuration #
#---------------------------------#
# Deployment provider settings
# (Providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment)
# NOTE: Provider names are case-sensitive!
deploy:
# FTP
- provider: FTP
protocol: ftp|ftps|sftp
host: ftp.myserver.com
username: admin
password: {secure: eYKZKFkkEvFYWX6NfjZIVw==}
folder: null
application: null
active_mode: false
beta: true # Enable alternative FTP library for 'ftp' and 'ftps' modes
debug: true # Show complete FTP log
# Amazon S3
- provider: S3
access_key_id: {secure: ABcd==}
secret_access_key: {secure: ABcd==}
bucket: my_bucket
folder: null
artifact: null
set_public: false
# Azure Blob storage
- provider: AzureBlob
storage_account_name: {secure: ABcd==}
storage_access_key: {secure: ABcd==}
container: my_container
folder: null
artifact: null
# Web Deploy
- provider: WebDeploy
server: http://www.deploy.com/myendpoint
website: mywebsite
username: user
password: {secure: eYKZKFkkEvFYWX6NfjZIVw==}
ntlm: false
remove_files: false
app_offline: false
do_not_use_checksum: true # Don't use checksums to compare source and destination files (default: false)
sync_retry_attempts: 2 # Maximum sync attempts
sync_retry_interval: 2000 # Timeout between sync attempts, in milliseconds
aspnet_core: true # Artefact ZIP contains ASP.NET Core application
aspnet_core_force_restart: true # Poke app's web.config before deploy to force application restart
skip_dirs: \\App_Data
skip_files: web.config
on:
branch: release
platform: x86
configuration: debug
# Azure Cloud Service
- provider: AzureCS
subscription_id: {secure: fjZIVw==}
subscription_certificate: {secure: eYKZKFkkEv...FYWX6NfjZIVw==}
storage_access_key: {secure: ABcd==}
storage_account_name: my_storage
service: my_service
slot: Production
target_profile: Cloud
artifact: MyPackage.cspkg
# NuGet feed
- provider: NuGet
server: https://my.nuget.server/feed
api_key: {secure: FYWX6NfjZIVw==}
skip_symbols: false
symbol_server: https://your.symbol.server/feed
artifact: MyPackage.nupkg
# GitHub Releases
- provider: GitHub
artifact: /.*\.nupkg/ # Uploads all NuGet packages to release assets
draft: false
prerelease: false
on:
branch: master # Release from master branch only
APPVEYOR_REPO_TAG: true # Deploy on tag push only
# A named environment
- provider: Environment
name: staging
on:
branch: staging
env_var1: value1
env_var2: value2
# Scripts run before deployment
before_deploy:
# Scripts run after deployment
after_deploy:
# Custom deploy logic instead of provider deployments
deploy_script:
# Disable deployment
#deploy: off
#---------------------------------#
# Global handlers #
#---------------------------------#
# Scripts run on a successful build
on_success:
- do something
# Scripts run on a failed failure
on_failure:
- do something
# Scripts run after every build, successful or not
on_finish:
- do something
#---------------------------------#
# Notifications #
#---------------------------------#
notifications:
# E-mail
- provider: Email
subject: 'Build {{status}}' # Optional
message: "{{message}}, {{commitId}}, ..." # Optional
on_build_status_changed: true
to:
- user1@email.com
- user2@email.com
# HipChat
- provider: HipChat
auth_token: {secure: RbOnSMSFKYzxzFRrxM1+XA==}
room: ProjectA
template: "{message}, {commitId}, ..."
# Slack (insecure)
- provider: Slack
incoming_webhook: http://incoming-webhook-url
# Slack (secured with auth token)
- provider: Slack
auth_token: {secure: kBl9BlxvRMr9liHmnBs14A==}
channel: development
template: "{message}, {commitId}, ..."
# Campfire
- provider: Campfire
account: appveyor
auth_token: {secure: RifLRG8Vfyol+sNhj9u2JA==}
room: ProjectA
template: "{message}, {commitId}, ..."
# Web-hook
- provider: Webhook
url: http://www.myhook2.com
on_build_success: false
on_build_failure: true
on_build_status_changed: true
headers:
User-Agent: myapp 1.0
Authorization: {secure: GhD+5xhLz/tkYY6AO3fcfQ==}
name: CI
on:
push: {branches: [master, ci]}
pull_request: {branches: [master, ci]}
workflow_dispatch:
# Enable manual execution via Actions tab
jobs:
test:
name: Test Node v${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [Ubuntu, macOS, Windows]
node: [13.2, 14, 16, 18]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install GNU on Windows
if: startsWith(matrix.os, 'Windows')
run: |
choco install gow
refreshenv
- name: Run package tests
shell: sh
run: |
node --version
npm --version
make all
make coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment