Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/cd.yml

This file was deleted.

123 changes: 56 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,78 @@
name: Build NSIS Plugin Dll's and Artifacts
on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- '*.sln'
- '*.vcproj'
- '*.vcxproj'
- 'Bin/Build.ps1'
- 'Src/**.c'
- 'Src/**.h'
- 'Src/**.lib'
- 'Tests/plugin_test.nsi'
- 'Src/**'
- 'Tests/PluginTest.nsi'
- '.github/workflows/**'
push:
branches:
branches:
- main
- master # remove onces migrated to main
tags:
- v*
# A tag push runs every time: GitHub doesn't apply path filters to tags
tags:
- 'v*'
paths:
- '*.sln'
- '*.vcproj'
- '*.vcxproj'
- 'Bin/Build.ps1'
- 'Src/**.c'
- 'Src/**.h'
- 'Src/**.lib'
- 'Tests/plugin_test.nsi'
- 'Src/**'
- 'Tests/PluginTest.nsi'
- '.github/workflows/**'
workflow_dispatch:
jobs:
build:
name: Build Dll's
runs-on: windows-latest
name: Build and test
# windows-2022 has Visual Studio 2022 (toolset v143) and NSIS 3.10, which the plugin test needs
runs-on: windows-2022
steps:
# checkout code from repo
- name: Checkout
uses: actions/checkout@v1
# Install Modules
- name: Setup Build Script
uses: actions/checkout@v7
- name: Install Invoke-MsBuild
run: Install-Module -Name Invoke-MsBuild -Force
# use msbuild to build the solution
- name: Build Plugin
- name: Build plugin
run: Bin\Build.ps1 New-Build
# upload artifacts
- name: Publish Lib Artifact
uses: actions/upload-artifact@v1
- name: Create EnVar-Plugin.zip
run: |
Bin\Build.ps1 New-Distribution
Bin\Build.ps1 Compress-Distribution
- name: Test plugin
run: |
Bin\Build.ps1 Deploy-Plugin
Bin\Build.ps1 Build-PluginTest
Bin\Build.ps1 Start-PluginTest
- name: Publish EnVar-Plugin.zip
uses: actions/upload-artifact@v7
with:
name: Lib-${{ github.sha }}
path: Lib
- name: Publish Obj Artifact
uses: actions/upload-artifact@v1
with:
name: Obj-${{ github.sha }}
path: Obj
# Prepare distribution folder
- name: Create Distribution
run: Bin\Build.ps1 New-Distribution, Compress-Distribution
# Publish Distribution Artifact
- name: Publish Dist Artifact
uses: actions/upload-artifact@v1
with:
name: Dist-${{ github.sha }}
path: Dist
- name: Publish Data Artifact
uses: actions/upload-artifact@v1
with:
name: Data-${{ github.sha }}
path: Data
# Deploy plugin
- name: Deploy plugin
run: Bin\Build.ps1 Deploy-Plugin
# Build PluginTest
- name: Build PluginTest
run: Bin\Build.ps1 Build-PluginTest
# Publish PluginTest Artifact
- name: Publish PluginTest Artifact
uses: actions/upload-artifact@v1
with:
name: PluginTest-${{ github.sha }}
path: Tests\PluginTest.exe
# Test Plugin
- name: Test Plugin
run: Bin\Build.ps1 Start-PluginTest
# Publish PluginTest Log Artifact
- name: Publish PluginTest Log Artifact
name: EnVar-Plugin
path: Data/EnVar-Plugin.zip
- name: Publish PluginTest log
if: ${{ always() }}
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v7
with:
name: PluginTest-Log
path: Tests/PluginTest.log
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download EnVar-Plugin.zip
uses: actions/download-artifact@v8
with:
name: PluginTest-Log-${{ github.sha }}
path: Tests\PluginTest.log
name: EnVar-Plugin
# A release made in the web UI already exists when its new tag starts this run, so it only gets the zip
- name: Create the release or attach EnVar-Plugin.zip to it
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" EnVar-Plugin.zip --repo "$GITHUB_REPOSITORY" --clobber
else
gh release create "$GITHUB_REF_NAME" EnVar-Plugin.zip --repo "$GITHUB_REPOSITORY" --title "$GITHUB_REF_NAME" --generate-notes --verify-tag
fi
4 changes: 4 additions & 0 deletions Bin/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function Update-Build
Write-Host "succeeded"
} else {
Write-Host "failed"
if ($BuildResult.BuildLogFilePath -and (Test-Path $BuildResult.BuildLogFilePath)) {
Get-Content $BuildResult.BuildLogFilePath
}
Throw "Build of $Configuration for $Platform failed: $($BuildResult.Message)"
}

$BuildResults += $BuildResult
Expand Down
18 changes: 9 additions & 9 deletions EnVar.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,51 +37,51 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{BA0F65F4-BA26-4236-8A77-93B53AE9EF6F}</ProjectGuid>
<RootNamespace>EnVar</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copied/forked from https://github.com/GsNSIS/EnVar 2025-04-24 so that
DDEV has a build version that it can depend on, since we don't know
the maintenance status of the upstream.

![Build NSIS Plugin Dll's and Artifacts](https://github.com/GsNSIS/EnVar/workflows/Build%20NSIS%20Plugin%20Dll's%20and%20Artifacts/badge.svg)
[![Build NSIS Plugin Dll's and Artifacts](https://github.com/ddev/EnVar/actions/workflows/ci.yml/badge.svg)](https://github.com/ddev/EnVar/actions/workflows/ci.yml)

Originally coded by Jason Ross aka JasonFriday13 on the forums.

Expand Down Expand Up @@ -85,7 +85,7 @@ For a example NSIS script visit [Docs/example.nsi](https://github.com/GsNSIS/EnV

### System Requirements

* Visual Studio 2015 or higher
* Visual Studio 2022 or higher, with the v143 toolset
* PowerShell 3.0 or higher (to run the build script)
* PowerShell Module [Invoke-MsBuild](https://github.com/deadlydog/Invoke-MsBuild#readme)
(to run the build script)
Expand All @@ -101,12 +101,41 @@ Install-Module -Name Invoke-MsBuild -Force
### Build and deploy

All build and deploy actions are implemented in a PowerShell
[build script](https://github.com/GsNSIS/EnVar/tree/master/Bin/Build.ps1).
[build script](Bin/Build.ps1).

Run `help Bin\Build` to get a detailed description of the available steps.

For a normal build and deploy run simply call the script without any parameters.

### Releasing

DDEV's installer build (`.ci-scripts/nsis_setup.sh` in ddev/ddev) downloads
`EnVar-Plugin.zip` from the latest release here.

1. Merge the changes to `main` and wait for the CI run to pass.
2. Tag `main` with the next version and push the tag:

```bash
git switch main && git pull
git tag v0.3.2
git push origin v0.3.2
```

3. The tag push runs the [CI workflow](https://github.com/ddev/EnVar/actions/workflows/ci.yml).
Its `release` job publishes the release with `EnVar-Plugin.zip`, and with notes
generated from the merged pull requests.

If the build fails, delete the tag with `git push --delete origin v0.3.2`,
fix the problem, and tag again.

You can also create the release in the web UI: "Draft a new release", a new tag
such as `v0.3.2` on `main`, "Generate release notes", and "Publish release". The
new tag runs the same workflow, which attaches `EnVar-Plugin.zip` to that release
a few minutes later. Until then the latest release has no zip, so DDEV's installer
build fails to download it. If the build fails, the release stays without the zip
until you fix the problem and run the
[workflow](https://github.com/ddev/EnVar/actions/workflows/ci.yml) again for the tag.

## License

This project is released under the terms of the [zlib License](LICENSE)