Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CziShrink #6

Merged
merged 33 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8e27afd
Move czicompress source to subfolder
m-ringler Nov 6, 2023
ae2d7f3
Add manual trigger for build
m-ringler Nov 7, 2023
48213e9
Turn off vcpkg for ubuntu
m-ringler Nov 7, 2023
d74ed8f
Merge pull request #1 from m-ringler/feature/adapt-repo-structure-bef…
m-ringler Nov 7, 2023
6933e9e
Rename codeql for czicompress
m-ringler Nov 7, 2023
521c24e
Update READMEs
m-ringler Nov 7, 2023
0d31a94
Add CziShrink to repo
m-ringler Nov 7, 2023
2a89b15
Fix REUSE
m-ringler Nov 7, 2023
dc9f6bd
Activate CodeQL for czishrink
m-ringler Nov 7, 2023
16f9241
Change workflow name
m-ringler Nov 7, 2023
7a81d43
Change workflow name
m-ringler Nov 7, 2023
fb34d1f
Adapt badges in Readme
m-ringler Nov 7, 2023
e37e3b8
Increment czishrink version
m-ringler Nov 7, 2023
1e91b9f
Fix cmake artifact upload
m-ringler Nov 7, 2023
e2a8496
Update build name in upgrade script
m-ringler Nov 7, 2023
759a643
Add run ID to VersionSuffix in dotnet build
m-ringler Nov 7, 2023
5efed57
Merge pull request #2 from m-ringler/feature/add-czishrink
m-ringler Nov 7, 2023
a1e577a
Fix links in README.md
m-ringler Nov 7, 2023
dd541b0
Update upgrade-libczicompressc.ps1
m-ringler Nov 7, 2023
9d8f3d9
Update upgrade-libczicompressc.ps1
m-ringler Nov 7, 2023
968743b
Update README.md
m-ringler Nov 7, 2023
968436f
Update README.md
m-ringler Nov 7, 2023
98531d4
Remove path filters from github workflows
m-ringler Nov 8, 2023
34cdbdf
Address CodeQL warnings
m-ringler Nov 8, 2023
530c8fe
Add workflow_dispatch trigger to all workflows
m-ringler Nov 9, 2023
be19476
Update czishrink/README.md
m-ringler Nov 9, 2023
bcdf0ee
Update czicompress/README.md
m-ringler Nov 9, 2023
72f8334
Update czishrink/README.md
m-ringler Nov 9, 2023
deaf345
Apply suggestions from code review
m-ringler Nov 9, 2023
7b37bb9
One .gitignore and one .gitattributes
m-ringler Nov 9, 2023
42a03d1
Get rid of custom xpath action
m-ringler Nov 9, 2023
87143a0
Fix REUSE
m-ringler Nov 9, 2023
0f9cbaf
Feature/czishrink third party artifact text (#4)
DaveyJonesBitPail Nov 9, 2023
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
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.gif filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.nupkg filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
7 changes: 7 additions & 0 deletions .github/actions/cmake-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ inputs:
platform:
description: 'OS platform'
required: true
src-dir:
description: 'The directory with the sources'
required: true
runs:
using: "composite"
steps:
Expand All @@ -33,18 +36,21 @@ runs:

- name: Set toolchain path
shell: bash
working-directory: ${{inputs.src-dir}}
run: echo "TOOLCHAIN_PATH=${{inputs.path-toolchain}}" >> "$GITHUB_ENV"

- name: Install dependencies
if: inputs.package == 'ON'
shell: bash
working-directory: ${{inputs.src-dir}}
run: |
# We install the following packages: eigen3, catch2, cli11. Installing them with vcpkg (and caching them)
# is faster than downloading and building them from source (which is the default behavior of the CZICompress-build-system).
vcpkg install --triplet ${{inputs.platform}} eigen3 catch2 cli11

- name: Configure CMake
shell: bash
working-directory: ${{inputs.src-dir}}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
#
Expand All @@ -53,5 +59,6 @@ runs:

- name: Build software
shell: bash
working-directory: ${{inputs.src-dir}}
# Build your program with the given configuration
run: cmake --build build --config ${{inputs.build-type}}
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# yamllint disable rule:document-start
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget"
directory: "/czishrink"
schedule:
interval: "weekly"
day: "wednesday"
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
name: CMake Build
name: CMake Build (czicompress)

on:
push:
branches: ["main"] # run only when merge with main branch
pull_request:
branches: ["main"] # run only when merge with main branch
workflow_dispatch: {}
m-ringler marked this conversation as resolved.
Show resolved Hide resolved

permissions:
contents: read
Expand All @@ -17,6 +18,9 @@ env:

jobs:
build-tests:
defaults:
run:
working-directory: ${{github.workspace}}/czicompress
name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}

Expand Down Expand Up @@ -46,16 +50,16 @@ jobs:
package: ON,
path-cache: '${{ github.workspace }}\vcpkg\installed',
path-toolchain: 'C:/vcpkg/scripts/buildsystems/vcpkg.cmake',
os-id: 'windows'
os-id: 'windows',
}
- {
name: ubuntu-release-package-on,
os: ubuntu-20.04, # we want to use an older version in order to increase likelihood that binaries work on other distros
platform: x64-linux,
package: ON,
package: OFF,
path-cache: '/usr/local/share/vcpkg/installed',
path-toolchain: '/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake',
os-id: 'linux'
os-id: 'linux',
}

steps:
Expand All @@ -71,32 +75,31 @@ jobs:
build-type: ${{env.BUILD_TYPE}}
package: ${{matrix.config.package}}
platform: ${{matrix.config.platform}}
src-dir: '${{github.workspace}}/czicompress'

- name: Run unit tests
working-directory: ${{github.workspace}}/build
working-directory: ${{github.workspace}}/czicompress/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

- name: Prepare licenses
working-directory: ${{github.workspace}}
shell: bash
run: |
set -e
mkdir ./czicompress-${{matrix.config.name}}
cp -R ./THIRD_PARTY_LICENSES_ARTIFACT_DISTRIBUTION.txt ./czicompress-${{matrix.config.name}}/
cp -R ./build/app/THIRD_PARTY_LICENSES.txt ./czicompress-${{matrix.config.name}}/

# gather the binaries
- name: Prepare Linux binaries
if: matrix.config.os == 'ubuntu-20.04'
working-directory: ${{github.workspace}}
shell: bash
run: |
cp ./build/app/czicompress ./build/capi/libczicompressc.so ./czicompress-${{matrix.config.name}}/

- name: Prepare Windows binaries
if: matrix.config.os == 'windows-latest'
working-directory: ${{github.workspace}}
shell: bash
run: |
cp ./build/app/${{env.BUILD_TYPE}}/*.exe ./build/capi/${{env.BUILD_TYPE}}/libczicompressc.dll ./czicompress-${{matrix.config.name}}/
Expand All @@ -106,4 +109,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: czicompress-${{matrix.config.name}}
path: czicompress-${{matrix.config.name}}/
path: czicompress/czicompress-${{matrix.config.name}}/
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: "CodeQL"
name: "CodeQL (czicompress)"

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "22 16 * * 4"
workflow_dispatch: {}

permissions:
actions: read
Expand All @@ -17,7 +17,10 @@ permissions:

jobs:
analyze:
name: Analyze
name: Analyze CPP
defaults:
run:
working-directory: ${{github.workspace}}/czicompress
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -50,6 +53,7 @@ jobs:
build-type: Release
package: ON
platform: x64-linux
src-dir: '${{github.workspace}}/czicompress'

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/czishrink_codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: "CodeQL (CziShrink)"

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '30 2 * * 2'
workflow_dispatch: {}
m-ringler marked this conversation as resolved.
Show resolved Hide resolved

permissions: read-all

jobs:
analyze:
name: Analyze CziShrink
defaults:
run:
working-directory: czishrink
runs-on: ubuntu-latest
permissions:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: csharp
queries: security-and-quality

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore -c Release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
135 changes: 135 additions & 0 deletions .github/workflows/czishrink_dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
permissions:
pull-requests: write
contents: read

name: .NET Build (CziShrink)

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch: {}
m-ringler marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:
defaults:
run:
working-directory: czishrink
name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}

strategy:
fail-fast: false
matrix:
config:
- {
name: windows,
os: windows-latest,
osfamily: win,
}
- {
name: ubuntu,
os: ubuntu-latest,
osfamily: linux,
}

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

- name: Get Version from Directory.Build.props
id: getversion
run: |
$xml = [xml](Get-Content -Path "Directory.Build.props")
$version = $xml.SelectSingleNode('//VersionPrefix').'#text' + "-" + $xml.SelectSingleNode('//VersionSuffix').'#text'
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
shell: pwsh

- name: Add build ID to version in Directory.Build.props
run: |
Write-Output "Add build ID ${{ github.run_id }} to VersionSuffix in Directory.Build.props"
$file = Get-Item "Directory.Build.props"
$xml = [xml](Get-Content -Path $file.FullName)
$versionElement = $xml.SelectSingleNode('//VersionSuffix')
$versionElement.'#text' += '+${{ github.run_id }}'
$xml.Save($file.FullName)
shell: pwsh

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore -c Release

- name: Test
run: >
dotnet test
-c Release
--no-build
--verbosity normal
--logger trx
--results-directory "TestResults"
-p:CollectCoverage=true
-p:CoverletOutputFormat=cobertura
-p:CoverletOutput=${{ github.workspace }}/TestResults/coverage.cobertura.xml
-p:ExcludeByAttribute=GeneratedCodeAttribute%2cObsoleteAttribute
-p:ExcludeByFile=**/*.axaml%2c**/*.g.cs
-p:Exclude='[netczicompress]netczicompress.Views.*'

- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
name: dotnet-results-${{ matrix.config.name }}
path: TestResults
# Use always() to also publish test results when there are test failures
if: ${{ always() }}

- name: Code Coverage Report
uses: irongut/[email protected]
if: matrix.config.name == 'ubuntu'
with:
filename: TestResults/coverage.cobertura.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: '60 80'

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && matrix.config.name == 'ubuntu'
with:
recreate: true
path: code-coverage-results.md
m-ringler marked this conversation as resolved.
Show resolved Hide resolved

- name: Publish
if: github.event_name == 'push'
run: >
dotnet publish netczicompress.Desktop/netczicompress.Desktop.csproj
-c Release
-a x64
--self-contained
-p:PublishSingleFile=true
-p:PublishReadyToRun=true
-p:PublishReadyToRunShowWarnings=true
-o ${{ github.workspace }}/publish

- name: Upload published binaries
uses: actions/upload-artifact@v3
if: github.event_name == 'push'
with:
name: CziShrink_${{ steps.getversion.outputs.version }}_${{ matrix.config.osfamily}}-x64
path: publish
1 change: 1 addition & 0 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches: ["main"] # run only when merge with main branch
pull_request:
branches: ["main"] # run only when merge with main branch
workflow_dispatch: {}

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch: {}

permissions:
contents: read
Expand Down
Loading