From 053ad5967b9a6180d39d788449b45365752793f5 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 10 Jul 2023 14:35:47 +0200 Subject: [PATCH] added woodpecker --- .editorconfig | 2 +- .woodpecker/build.yml | 16 +++++++++++++++ .woodpecker/docs.yml | 16 +++++++++++++++ Jenkinsfile | 48 ------------------------------------------- build.cake | 7 ++++--- 5 files changed, 37 insertions(+), 52 deletions(-) create mode 100644 .woodpecker/build.yml create mode 100644 .woodpecker/docs.yml delete mode 100644 Jenkinsfile diff --git a/.editorconfig b/.editorconfig index 6deb0c2..f2769d3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -113,6 +113,6 @@ resharper_xmldoc_attribute_indent = align_by_first_attribute resharper_xmldoc_attribute_style = on_single_line resharper_xmldoc_pi_attribute_style = on_single_line -[*.md] +[{*.md,*.yaml,*.yml}] trim_trailing_whitespace = false indent_size = 2 diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 0000000..19827c2 --- /dev/null +++ b/.woodpecker/build.yml @@ -0,0 +1,16 @@ +steps: + build: + image: runmymind/docker-android-sdk:ubuntu-standalone + commands: + # install xvfb to allow for graphics-dependent tests + - apt-get update && apt-get install -y --no-install-recommends xauth xvfb openjdk-11-jdk + # install dotnet + - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 7.0.305 + - export DOTNET_ROOT=$HOME/.dotnet + - export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools + # run cake + - dotnet tool restore + - xvfb-run -a dotnet cake --target Publish --branch $CI_COMMIT_BRANCH + secrets: + - nuget_key + - baget_key diff --git a/.woodpecker/docs.yml b/.woodpecker/docs.yml new file mode 100644 index 0000000..288eb25 --- /dev/null +++ b/.woodpecker/docs.yml @@ -0,0 +1,16 @@ +steps: + document: + image: mcr.microsoft.com/dotnet/sdk:7.0.305 + commands: + - dotnet tool restore + - dotnet cake --target Document --branch $CI_COMMIT_BRANCH + deploy: + image: debian:latest + when: + - event: [push, manual] + branch: release + commands: + - rm -rfv /var/www/MLEM/* + - cp -rv Docs/_site/. /var/www/MLEM/ + volumes: + - /var/www/MLEM:/var/www/MLEM diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 0a793e0..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,48 +0,0 @@ -pipeline { - agent none - stages { - stage('Cake') { - agent any - stages { - stage('Submodules') { - steps { - sh 'git submodule update --init --recursive --force' - } - } - stage('Build') { - steps { - sh 'dotnet tool restore' - // we use xvfb to allow for graphics-dependent tests - sh 'xvfb-run -a dotnet cake --target Publish --branch ' + env.BRANCH_NAME - } - } - stage('Document') { - steps { - sh 'dotnet cake --target Document --branch ' + env.BRANCH_NAME - stash includes: 'Docs/_site/**', name: 'site' - } - } - } - post { - always { - nunit testResultsPattern: '**/TestResults.xml' - cobertura coberturaReportFile: '**/coverage.cobertura.xml' - } - } - } - stage('Publish Docs') { - when { branch 'release' } - agent { label 'web' } - options { skipDefaultCheckout() } - steps { - unstash 'site' - sh 'rm -rf /var/www/MLEM/*' - sh 'cp Docs/_site/** /var/www/MLEM/ -r' - } - } - } - environment { - BAGET = credentials('3db850d0-e6b5-43d5-b607-d180f4eab676') - NUGET = credentials('e1bf7f6c-6047-4f7e-b639-15240a8f8351') - } -} diff --git a/build.cake b/build.cake index b14ab73..7cdf8b1 100644 --- a/build.cake +++ b/build.cake @@ -9,11 +9,12 @@ var config = Argument("configuration", "Release"); var serve = HasArgument("serve"); Task("Prepare").Does(() => { + DotNetWorkloadInstall("android"); DotNetRestore("MLEM.sln"); DotNetRestore("MLEM.FNA.sln"); if (branch != "release") { - var buildNum = EnvironmentVariable("BUILD_NUMBER"); + var buildNum = EnvironmentVariable("CI_PIPELINE_NUMBER"); if (buildNum != null) version += "-ci." + buildNum; } @@ -53,12 +54,12 @@ Task("Push").WithCriteria(branch == "main" || branch == "release").IsDependentOn if (branch == "release") { settings = new NuGetPushSettings { Source = "https://api.nuget.org/v3/index.json", - ApiKey = EnvironmentVariable("NUGET") + ApiKey = EnvironmentVariable("NUGET_KEY") }; } else { settings = new NuGetPushSettings { Source = "https://nuget.ellpeck.de/v3/index.json", - ApiKey = EnvironmentVariable("BAGET") + ApiKey = EnvironmentVariable("BAGET_KEY") }; } settings.SkipDuplicate = true;