Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into hotfix/logobjects…
Browse files Browse the repository at this point in the history
…notfound
  • Loading branch information
jupster committed Oct 13, 2024
2 parents 5249e89 + adb6aee commit bff6ca8
Show file tree
Hide file tree
Showing 16 changed files with 390 additions and 238 deletions.
11 changes: 0 additions & 11 deletions .github/release.yml

This file was deleted.

81 changes: 67 additions & 14 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: "Code Analysis"
on:
push: # The master branch must be analyzed on a new commit
branches: [ master ]
tags-ignore:
- '*'
pull_request:
# Any PR on master must be analyzed
branches: [ master ]
Expand Down Expand Up @@ -40,29 +42,80 @@ jobs:
uses: actions/[email protected]
with:
dotnet-version: ${{vars.DOTNET_VERSION}}

- run: dotnet restore
- run: dotnet build ./FASTER.sln --configuration Debug

- name: Restore Solution
run: dotnet restore ./FASTER.sln

- name: Build Solution
run: dotnet build ./FASTER.sln --configuration Debug

- name: Execute unit tests
run: dotnet test

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

AnalysisSonar:
name: Analyze with SonarCloud
runs-on: ubuntu-latest
runs-on: windows-latest
permissions:
pull-requests: write # allows SonarCloud to decorate PRs with analysis results

steps:
- name: Analyze with SonarCloud
# steps: # DOES NOT SCAN FOR SOME REASON ?
# - name: Analyze with SonarCloud

# # You can pin the exact commit or the version.
# uses: SonarSource/sonarcloud-github-action@v3
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# with:
# # Additional arguments for the SonarScanner CLI
# args:
# -Dsonar.projectKey=Foxlider_FASTER
# -Dsonar.organization=foxlicorp
# projectBaseDir: .


# You can pin the exact commit or the version.
uses: SonarSource/sonarcloud-github-action@v3
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.

- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: pwsh
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.PR_DECORATION }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
# Additional arguments for the SonarScanner CLI
args:
-Dsonar.projectKey=Foxlider_FASTER
-Dsonar.organization=foxlicorp
projectBaseDir: .
shell: pwsh
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Foxlider_FASTER" /o:"foxlicorp" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
150 changes: 125 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ on:
workflow_dispatch: # ReleaseGen can be triggered manually

env:
IS_TAG: ${{ github.ref_type == 'tag' }}
IS_RELEASE: ${{ github.ref_type == 'tag' }}
ZIP_NAME: ${{ github.ref_type == 'tag' && 'Release_' || 'Release_Nightly_' }}
ZIP_PATH: ${{ github.ref_type == 'tag' && 'FASTER_' || 'FASTER_Nightly_' }}

jobs:

# BUILD APP
build:

if: ( github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' ) || startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
# runtime: [x64, x86]
Expand All @@ -43,19 +43,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{vars.DOTNET_VERSION}}

# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: dotnet restore
Expand All @@ -68,63 +66,165 @@ jobs:

# Pub
- name: Publish the application ${{ matrix.runtime }}
run: dotnet publish --configuration $env:Configuration -a $env:Runtime --self-contained true /p:useapphost=true --output .\$env:ZIP_NAME$env:Runtime ./FASTER/FASTER.csproj
run: dotnet publish --configuration $env:Configuration -a $env:Runtime --self-contained true -p:PublishSingleFile=true /p:useapphost=true --output .\$env:ZIP_NAME$env:Runtime ./FASTER/FASTER.csproj
env:
Runtime: ${{ matrix.runtime }}

# Zip the folder
# Zip the folder
- name: Zip the application folder
run: Compress-Archive -Path .\$env:ZIP_NAME$env:Runtime\* -DestinationPath .\$env:ZIP_NAME$env:Runtime.zip
shell: pwsh
env:
Runtime: ${{ matrix.runtime }}

# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
# - name: Upload build artifacts
# uses: actions/upload-artifact@v4
# with:
# name: Release_Nightly_${{ env.Runtime }}
# path: .\FASTER_Nightly_${{ env.Runtime }}
# env:
# Runtime: ${{ matrix.runtime }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.runtime }}
path: .\${{ env.ZIP_NAME}}${{ matrix.runtime }}.zip

release:
needs: build
runs-on: windows-latest
steps:

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for tags history processing

- name: Download x64 artifact
uses: actions/download-artifact@v2
with:
name: build-x64
path: ./artifacts

# Get version number
- name: get-net-sdk-project-versions-action
uses: kzrnm/[email protected]
id: get-version
with:
proj-path: ./FASTER/FASTER.csproj

# Get Changes between Tags
- name: Generate Changelog
id: get-changes
run: |
Write-Output "::group::Collecting Changes between Tags..."
# Set options from inputs
$tagPattern = "^v?\d\.\d+([a-zA-Z]|\.\d+([a-zA-Z])?)?"
$linePrefix = "- "
# Fetch all tags from origin
git fetch origin --tags --force
# Get tags that match the pattern and sort them using version sorting in reverse
$tags = git tag --sort=committerdate -l | Select-String -Pattern $tagPattern | Sort-Object -Descending || ""
# Count the found tags
$countTags = ($tags -split "`n").Count
# Exit with error if no tags are found
if ($tags -eq "" -or $countTags -le 0) {
Write-Output "::error title=no tags found::changes-between-tags action could not find any tags to work with"
exit 1
}
# Take the first tag as latestTag
$latestTag = ($tags -split "`n")[0]
# Get changes for range
# Check if the latest tag is on the last commit
$latestCommit = git rev-parse HEAD
$latestTagCommit = git rev-list -n 1 $latestTag
if ($latestCommit -eq $latestTagCommit -and $countTags -gt 1) {
# Use the previous tag if the latest tag is on the last commit
$latestTag = ($tags -split "`n")[1]
}
$range = "$latestTag" + "..@"
$changes = git log --pretty=reference --no-decorate $range
# If set, add a prefix to every commit message
if ($linePrefix) {
$changes = $changes -replace "^(.*)$", "$linePrefix`$1"
}
# Set outputs
$EOF = (New-Guid).Guid
"changes<<$EOF" >> $env:GITHUB_OUTPUT
$changes >> $env:GITHUB_OUTPUT
"$EOF" >> $env:GITHUB_OUTPUT
"tag=$latestTag" >> $env:GITHUB_OUTPUT
# Log the results
Write-Output "tag: $latestTag"
Write-Output "changes:"
Write-Output $changes
# End log grouping
Write-Output "::endgroup::"
shell: pwsh

# Set Version Number to environment
- name: Set Version
id: set_version
run: |
if ($env:IS_TAG -eq "true") {
if ($env:IS_RELEASE -eq "true") {
echo "VERSION=$env:GITHUB_REF" >> $env:GITHUB_ENV
} else {
echo "VERSION=${{ steps.get-version.outputs.version }}" >> $env:GITHUB_ENV
}
shell: pwsh

#Create Release
- name: Create Release
if: env.IS_RELEASE == 'true'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: v${{ env.VERSION }}
release_name: ${{ env.IS_TAG == 'true' && 'Release' || 'PreRelease' }} ${{ env.VERSION }}
tag_name: '${{ env.VERSION }}'
release_name: 'Release ${{ env.VERSION }}'
body: |
Changelog since release ${{ steps.get-changes.outputs.tag }} :
---
${{ steps.get-changes.outputs.changes }}
---
draft: false
prerelease: ${{ env.IS_TAG == 'false' }}
prerelease: ${{ env.IS_RELEASE == 'false' }}

#Upload Artifacts
# Upload Artifacts
- name: Upload Release Asset
if: env.IS_RELEASE == 'true'
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Runtime: ${{ matrix.runtime }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: .\${{ env.ZIP_NAME}}${{ env.Runtime }}.zip
asset_name: ${{ env.ZIP_NAME}}${{ env.Runtime }}.zip
asset_path: ./artifacts/${{ env.ZIP_NAME}}x64.zip
asset_name: ${{ env.ZIP_NAME}}x64.zip
asset_content_type: application/zip


# Create Nightly Release
- name: Create Nightly Release
if: env.IS_RELEASE == 'false'
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'Nightly Release v${{ env.VERSION }}'
body: |
Changelog since release ${{ steps.get-changes.outputs.tag }} :
---
${{ steps.get-changes.outputs.changes }}
---
prerelease: true
files: ./artifacts/${{ env.ZIP_NAME}}x64.zip
2 changes: 2 additions & 0 deletions FASTER.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
FASTER_Version.xml = FASTER_Version.xml
NuGet.Config = NuGet.Config
.github\workflows\publish.yml = .github\workflows\publish.yml
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FASTERTests", "FASTERTests\FASTERTests.csproj", "{65FDF864-BF9B-414A-A6E6-3473BCFB62BE}"
Expand Down
Loading

0 comments on commit bff6ca8

Please sign in to comment.