Skip to content

Commit

Permalink
JMeter .Net DSL functional initial version with Azure & BlazeMeter en…
Browse files Browse the repository at this point in the history
…gines
  • Loading branch information
rabelenda committed Jul 6, 2023
0 parents commit 4a4aa4b
Show file tree
Hide file tree
Showing 119 changed files with 9,229 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[*.cs]

csharp_style_expression_bodied_methods=when_on_single_line
dotnet_analyzer_diagnostic.severity = error
dotnet_diagnostic.CS1591.severity = none
# dotnet_diagnostic.CA1051.severity = none
# dotnet_diagnostic.CA1304.severity = none
# dotnet_diagnostic.CA1305.severity = none
# dotnet_diagnostic.CA1309.severity = none
# dotnet_diagnostic.CA1310.severity = none
# dotnet_diagnostic.CA1715.severity = none
dotnet_diagnostic.CA1822.severity = none
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0039.severity = none
dotnet_diagnostic.IDE0052.severity = none
dotnet_diagnostic.IDE0058.severity = none
dotnet_diagnostic.IDE0063.severity = none
dotnet_diagnostic.IDE0065.severity = none
dotnet_diagnostic.IDE0090.severity = none
dotnet_diagnostic.JSON002.severity = none
19 changes: 19 additions & 0 deletions .github/fix-docs-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
#
# This script takes care of setting proper JMeter DSL version in docs.
#
set -eo pipefail

VERSION=$1

update_file_versions() {
local VERSION="$1"
local FILE="$2"
sed -i "s/--version [0-9.]\+/--version ${VERSION}/g" "${FILE}"
}

update_file_versions ${VERSION} README.md

find docs -name "*.md" -not -path "*/node_modules/*" | while read DOC_FILE; do
update_file_versions ${VERSION} ${DOC_FILE}
done
19 changes: 19 additions & 0 deletions .github/fix-project-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
#
# This script takes care of setting proper JMeter DSL version in projects.
#
set -eo pipefail

VERSION=$1

update_file_versions() {
local VERSION="$1"
local FILE="$2"
sed -i "s/<AssemblyVersion>[0-9.]\+<\/AssemblyVersion>/<AssemblyVersion>${VERSION}.0<\/AssemblyVersion>/g" "${FILE}"
sed -i "s/<Version>[0-9.]\+<\/Version>/<Version>${VERSION}<\/Version>/g" "${FILE}"
sed -i "s/<FileVersion>[0-9.]\+<\/FileVersion>/<FileVersion>${VERSION}<\/FileVersion>/g" "${FILE}"
}

find . -name "*.csproj" | while read DOC_FILE; do
update_file_versions ${VERSION} ${DOC_FILE}
done
10 changes: 10 additions & 0 deletions .github/next-minor-alpha.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
#
# This script solves next minor version
set -eo pipefail

VERSION="$1"
MAJOR="${VERSION%%.*}"
VERSION="${VERSION#*.}"
MINOR="${VERSION%%.*}"
echo "${MAJOR}.$((MINOR + 1))-alpha1"
15 changes: 15 additions & 0 deletions .github/nuget-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# This script takes care of deploying packages to nuget
#
# Required environment variables: NUGET_API_KEY

set -eo pipefail

push_package() {
dotnet nuget push "$1" --api-key "${NUGET_API_KEY}" --source https://api.nuget.org/v3/index.json
}

find . -name "*.nupkg" -or -name "*.snupkg" | while read PACKAGE; do
push_package ${PACKAGE}
done
19 changes: 19 additions & 0 deletions .github/semver-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
#
# This script checks that the version number of the release is an expected one, and avoid erroneous releases which don't follow semver
set -eo pipefail

git fetch --tags --quiet
VERSION="$1"
PREV_VERSION=$(git tag --sort=-creatordate | head -1)
PREV_VERSION=${PREV_VERSION:-v0.0}
PREV_VERSION=${PREV_VERSION#v}
PREV_MAJOR="${PREV_VERSION%%.*}"
PREV_VERSION="${PREV_VERSION#*.}"
PREV_MINOR="${PREV_VERSION%%.*}"
PREV_PATCH="${PREV_VERSION#*.}"
if [[ "$PREV_VERSION" == "$PREV_PATCH" ]]; then
PREV_PATCH="0"
fi

[[ "$VERSION" == "$PREV_MAJOR.$PREV_MINOR.$((PREV_PATCH + 1))" || "$VERSION" == "$PREV_MAJOR.$((PREV_MINOR + 1))" || "$VERSION" == "$((PREV_MAJOR + 1)).0" ]]
21 changes: 21 additions & 0 deletions .github/update-sample-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#
# This script takes care of updating JMeter DSL version in sample project.
#
set -eox pipefail

VERSION=$1

USER_EMAIL="$(git log --format='%ae' HEAD^!)"
USER_NAME="$(git log --format='%an' HEAD^!)"

cd jmeter-dotnet-dsl-sample
sed -i 's/Include="Abstracta.JmeterDsl" Version="[0-9.]\+"/Include="Abstracta.JmeterDsl" Version="${VERSION}"/g' Abstracta.JmeterDsl.Sample/Abstracta.JmeterDsl.Sample.csproj

git add .
git config --local user.email "$USER_EMAIL"
git config --local user.name "$USER_NAME"
git commit -m "Updated Abstracta.JmeterDsl version"
git push origin HEAD:master
cd ..
rm -rf jmeter-dotnet-dsl-sample
23 changes: 23 additions & 0 deletions .github/vuepress-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env sh
#
# This script takes care of building and deploying the vuepress documentation to github pages.
#
set -e

cd docs

pnpm install && pnpm build

cd .vuepress/dist

EMAIL="$(git log --format='%ae' HEAD^!)"
USERNAME="$(git log --format='%an' HEAD^!)"
git init
git config --local user.email "$EMAIL"
git config --local user.name "$USERNAME"
git add .
git commit -m '[skip ci] Deploy docs to GitHub pages'

git push -f https://git:${ACCESS_TOKEN}@github.com/abstracta/jmeter-java-dsl.git master:gh-pages

cd $GITHUB_WORKSPACE
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: run tests
on:
push:
tags-ignore:
- "*"
branches:
- "**"
jobs:
test:
runs-on: ubuntu-latest
concurrency: azure_test
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: maven
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
# avoid running tests in parallel since it may happen that two tests try to modify .jmeter-dsl directory
run: dotnet test -m:1 --no-build --configuration Release --verbosity normal
env:
AZURE_CREDS: ${{ secrets.AZURE_CREDS }}
BZ_TOKEN: ${{ secrets.BZ_TOKEN }}
94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: release
run-name: release ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
concurrency: remote_test
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: maven
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: check version
run: .github/semver-check.sh ${{ inputs.version }}
- name: create release draft
uses: ncipollo/release-action@v1
with:
tag: v${{ inputs.version }}
name: ${{ inputs.version }}
draft: true
- name: set project version
run: .github/fix-project-version.sh ${{ inputs.version }}
- name: update docs version
run: .github/fix-docs-version.sh ${{ inputs.version }}
- name: commit release version
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[skip ci] Set release version'
branch: master
file_pattern: '*/*.csproj README.md docs/index.md docs/guide/**'
- name: Build
run: dotnet build --configuration Release
- name: Test
# avoid running tests in parallel since it may happen that two tests try to modify .jmeter-dsl directory
run: dotnet test -m:1 --no-build --configuration Release --verbosity normal
env:
AZURE_CREDS: ${{ secrets.AZURE_CREDS }}
BZ_TOKEN: ${{ secrets.BZ_TOKEN }}
- name: Package
run: dotnet pack --no-build --configuration Release
- name: publish to Nuget
run: .github/nuget-deploy.sh
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: publish GH release
uses: ncipollo/release-action@v1
with:
tag: v${{ inputs.version }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
updateOnlyUnreleased: true
draft: false
- name: get next alpha version
run: echo "ALPHA_VERSION=$(.github/next-minor-alpha.sh ${{ inputs.version }})" >> $GITHUB_ENV
- name: update to next ALPHA version
run: .github/fix-project-version.sh ${{ env.ALPHA_VERSION }}
- name: commit ALPHA version
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[skip ci] Set ALPHA version'
branch: master
file_pattern: '*/*.csproj README.md docs/index.md docs/guide/**'
- name: deploy github pages
run: .github/vuepress-deploy.sh
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
repository: abstracta/jmeter-dotnet-dsl-sample
path: jmeter-dotnet-dsl-sample
token: ${{ secrets.ACTIONS_TOKEN }}
- name: update version in sample project
run: .github/update-sample-version.sh ${{ inputs.version }}
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: 'A new release is out! Check it at https://github.com/abstracta/jmeter-dotnet-dsl/releases/tag/v${{ inputs.version }}'
Loading

0 comments on commit 4a4aa4b

Please sign in to comment.