Github integration test for each version - .net-core

I have create this integration test that working fine, but it's support one why version. I need to run the integration test for all version that support my code, but i can't understand what the best way to do.
name: Unstable release deploy to MyGet
on:
push:
branches:
- dev
jobs:
build-test-package:
runs-on: ubuntu-latest
env:
MyNode_NodeEndPoint: "http://127.0.0.1/"
MyNode_NodeVersion: "1.0.0"
steps:
- name: Checkout
uses: actions/checkout#master
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet#v2
with:
dotnet-version: 6.0.x
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Setup Node.js environment
uses: actions/setup-node#v3.3.0
- name: Start MyNodes
run: MyNodeJS start "${{env.MyNode_NodeVersion}}"
- name: Run integration tests
run: dotnet test --configuration Release
- name: Generate nuget package
run: dotnet pack --configuration Release -o nupkg
- name: Push packages
run: dotnet nuget push './nupkg/*.nupkg' --api-key ${{secrets.MYGET_APIKEY}} --source https://www.myget.org/F/MyNode/api/v3/index.json
i need to repeat test for each version, so i need to create an array of versione
MyNode_NodeVersion: "1.0.0"
MyNode_NodeVersion: "1.0.1"
MyNode_NodeVersion: "1.0.2"
What is the best way?

Related

GitHub Actions Create a Release After Tagging

I have the following yml file that creates a release when I push an annotated tag like this:
git tag -a v2.2.2 -m "Your comments" // Create annotated tag
git push origin --tags // Push annotated tag
The release yml file:
name: release ocpp-scala
on:
release:
types: [ created ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
uses: ./.github/workflows/build.yml
publish:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout#v2
- name: sbt ci-release
run: sbt publish
After this runs, I can see that the jar and other archives are created under packages. I also want to have a release page that contains the description of what was done for this release and who the contributors were. I can see that from the tag page, there is a "Create Release From Tag" button available:
But is there a way to create this automatically from a CI pipeline step?

AWS Amplify - Lerna Monorepo - Can't install private github package

I am having trouble installing a private github package with my lerna monorepo using AWS Amplify hosting.
I have updated the build settings to create a .npmrc file at the time of build and install the package in the preBuild stage, however when it begins the build stage it cannot find the module.
Reproduction steps
Set up amplify hosting for react app as monorepo (Lerna)
Update build settings to create .npmrc and install package
Run build
Build settings
version: 1
applications:
- backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn install --frozen-lockfile
- echo -e "always-auth=true\n#apptractive:registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=$NPM_AUTH_TOKEN" > .npmrc
- yarn add #apptractive/shared
- yarn add #apptractive/design-system-web
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
appRoot: packages/backoffice-app
Error that shows
Okay I found that I needed to build the packages within the build script as they were being imported from the monorepo itself and not github packages.
Probably can be done with a better approach, but this got me over the line for now
version: 1
applications:
- backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn global add lerna
- npm config set registry https://npm.pkg.github.com
- npm config set always-auth true
- npm config set //https://npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN}
- lerna bootstrap --include-dependencies
- cd ../shared && yarn build
- cd ../design-web && yarn build
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
appRoot: packages/backoffice-app

GitHub actions fails publishing to Azure

I'm trying to build and deploy ASP.NET Web application using GitHub actions and Azure.
I've successfully created and published to Azure a small app (.NET 4.8) using VS2017.
Now I'm trying to setup automatic deployment and I'm using the basic GitHub actions workflow that you get from Azure when setting up deployment.
When running the action I get into this error:
D:\a\pathtomyproject\myprojectname.csproj : error MSB4057: The target "pipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.
Here's the full action:
name: Build and deploy ASP app to Azure Web App
on:
push:
branches:
- develop
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: 'windows-latest'
steps:
- uses: actions/checkout#master
- name: Setup MSBuild path
uses: microsoft/setup-msbuild#v1.0.2
- name: Setup NuGet
uses: NuGet/setup-nuget#v1.0.5
- name: Restore NuGet packages
run: nuget restore
- name: Publish to folder
run: msbuild /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="\published\"
- name: Deploy to Azure Web App
uses: azure/webapps-deploy#v2
with:
app-name: 'myname'
slot-name: 'production'
publish-profile: ${{ ... }}
package: \published\
Specifically, the error occurs during "Publish to folder" step.
Found the solution to my problem. Since I was using multi project solution, I had to modify msbuild command and specify to build my startup project. Now my publish to folder step looks something like this:
- name: Publish to folder
run: msbuild src\myproj\myproj.csproj ...

Gitlab pipeline running into errors when adding NuGet source

I am trying to add a pipeline to my project. The project is a AWS Lambda written in dotnet. I want to build a pipeline so that it is deployed to AWS whenever I update the code of my Lambda. Here is my code for the pipeline:
image: mcr.microsoft.com/dotnet/core/sdk:3.1
stages:
- build
- deploy
- production
before_script:
- apt update
- apt-get -y install zip
- export PATH="$PATH:/root/.dotnet/tools"
- dotnet tool install -g Amazon.Lambda.Tools
build:
stage: 'build'
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- echo `aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION` | sh
- dotnet nuget add sourceĀ url
- dotnet restore
- cd SmoothRunningsAuth
- dotnet lambda package -o publish/$CI_PIPELINE_ID.zip
when: always
artifacts:
name: "$CI_JOB_NAME"
paths:
- project/publish/$CI_PIPELINE_ID.zip
I have tested all of these commands locally and they work fine when I build the package. dotnet nuget add source url is required as I am using packages from a private repository I am using.
However when I push this to GitLab it returns the following errors:
I am not sure why this is happening, it runs all the other dotnet commands fine and this is the command I use when I am trying to add sources.

Docker Image For Deploying DotNet Core Output to Firebase

I'm struggling to create a BitBucket Pipeline script which can compile a DotNet Core application, run it and then deploy the output html files to Firebase using the CLI.
image: microsoft/dotnet:sdk
pipelines:
default:
- step:
caches:
- dotnetcore
script:
- dotnet restore
- dotnet build MySolution.sln
branches:
master:
- step:
caches:
- dotnetcore
script:
- dotnet restore
- dotnet build MySolution.sln
- cd MySolution
- dotnet run MySolution.
- npm install -g firebase-tool
- firebase deploy --token "$FIREBASE_TOKEN"
The image microsoft/dotnet:sdk doesn't contain npm or the Firebase-Tools package I require. I'm struggling to find an alternative Docker Image which contains both dotnet and npm / Firebase-Tools. Is there a simpler way to deploy the output of the application to Firebase directly from BitBucket?
I think you should dig into the multi-step approach of Bitbucket pipelines. There you will be able to run each of the steps with different docker images.
More documentation you may find at Bitbucket here
For example:
pipelines:
default:
- step:
name: Build and test
image: microsoft/dotnet:sdk
script:
- dotnet restore
- dotnet build
- dotnet publish -o /out -c Release
artifacts:
- out/**
- step:
name: Run npm
image: node:8
script:
- npm install -g firebase-tool
- firebase deploy --token "$FIREBASE_TOKEN"
- step
name: Run app
image: microsoft/dotnet:sdk
script:
- dotnet run MySolution .

Resources