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
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ jobs:
ref: main
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

# The release is built from main (the workflow commits the version and AutoUpdater XML to it).
# Refuse to release if main is not the tagged commit, so the package always matches the tag.
- name: Check that the tag points to main
run: |
$mainSha = git rev-parse HEAD
$tagSha = "${{ github.sha }}"
if ($mainSha -ne $tagSha) {
Write-Error "Tag ${{ github.ref_name }} points to $tagSha but main is at $mainSha. Tag the latest commit of main."
exit 1
}
echo "Tag ${{ github.ref_name }} matches main ($mainSha)"
shell: powershell

- name: Setup .NET
uses: actions/setup-dotnet@v4
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'

- name: Restore dependencies
run: dotnet restore CanonSDK.sln

- name: Build solution
run: dotnet build CanonSDK.sln --configuration Release --no-restore

- name: Run unit tests
run: dotnet test Canon.Core.Tests/Canon.Core.Tests.csproj --configuration Release --no-build --logger trx --results-directory TestResults

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: TestResults
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to CanonWebAPI are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
Versions match the Git tags (`v1.0.0.11`) that trigger the release workflow.

## [Unreleased]

### Changed
- The release workflow refuses to run when the tag does not point to the latest commit of `main`,
so the published package always matches the tag.

### Added
- CI workflow building the solution and running the unit tests on every pull request and push to `main`.

## [1.1.0.0] - Unreleased

### Changed
Expand Down Expand Up @@ -136,7 +145,8 @@ First release.
- Automatic updates with AutoUpdater.NET, from GitHub releases.
- CI/CD workflow building the release package.

[1.1.0.0]: https://github.com/dansleboby/CanonWebAPI/compare/v1.0.0.11...HEAD
[Unreleased]: https://github.com/dansleboby/CanonWebAPI/compare/v1.1.0.0...HEAD
[1.1.0.0]: https://github.com/dansleboby/CanonWebAPI/compare/v1.0.0.11...v1.1.0.0
[1.0.0.11]: https://github.com/dansleboby/CanonWebAPI/compare/v1.0.0.10...v1.0.0.11
[1.0.0.10]: https://github.com/dansleboby/CanonWebAPI/compare/v1.0.0.9...v1.0.0.10
[1.0.0.9]: https://github.com/dansleboby/CanonWebAPI/compare/v1.0.0.8...v1.0.0.9
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Errors are problem details: 400 invalid value, 409 capture refused, 503 not conn

## Important Notes

- Camera must be connected via USB before starting the application
- The camera can be connected via USB before or after the application starts (automatic connection and reconnection)
- Canon EOS Utility must NOT be running (conflicts with EDSDK access)
- Requires compatible Canon camera with EDSDK support
- All projects target .NET 9 with Windows-specific dependencies
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ dotnet run --project Canon.API
This project uses automated GitHub Actions for releases:

1. **Changelog**: Move the changes of the `Unreleased` section of [CHANGELOG.md](CHANGELOG.md) under the new version and date, and update the version in `Canon.API/Canon.API.csproj`
2. **Tag-based releases**: Push a tag like `v1.1.0.0` on `main` to trigger automated build and release
2. **Tag-based releases**: Push a tag like `v1.1.0.0` on the latest commit of `main` to trigger automated build and release (the workflow refuses a tag on another commit)
3. **Version synchronization**: The workflow automatically updates project versions to match the tag
4. **Unit tests**: The workflow runs `Canon.Core.Tests` before packaging
5. **Automatic packaging**: Creates release packages and updates the AutoUpdater XML
Expand All @@ -170,6 +170,8 @@ dotnet run --project Canon.API
dotnet test Canon.Core.Tests
```

The `CI` GitHub Actions workflow builds the solution and runs these tests on every pull request and push to `main`.

The tests cover the value tables, the capture timeout, the file type filter, the SDK thread and the live view broadcaster. They do not need a camera and also run on Linux/macOS.

### Docker (Windows containers)
Expand Down
Loading