Skip to content

feat: async results #2066

feat: async results

feat: async results #2066

Workflow file for this run

name: DeployTest
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
pull_request:
jobs:
versionning:
name: Versionning
runs-on: ubuntu-latest
outputs:
version: ${{ steps.genver.outputs.version }}
release: ${{ steps.genver.outputs.release }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Generate Version
id: genver
run: |
VERSION=$(docker run --rm -v $(pwd):/repo codacy/git-version /bin/git-version --folder=/repo --release-branch=${{ github.ref_name }}-pre --dev-branch=main)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION : $VERSION"
RELEASE=$(docker run --rm -v $(pwd):/repo codacy/git-version /bin/git-version --folder=/repo --release-branch=${{ github.ref_name }} --dev-branch=main)
echo "release=$RELEASE" >> $GITHUB_OUTPUT
echo "RELEASE : $RELEASE"
echo "Version :" >> $GITHUB_STEP_SUMMARY
echo "$VERSION" >> $GITHUB_STEP_SUMMARY
echo "Release :" >> $GITHUB_STEP_SUMMARY
echo "$RELEASE" >> $GITHUB_STEP_SUMMARY
buildProjects:
runs-on: ubuntu-latest
needs:
- versionning
env:
GENVERSION: ${{ needs.versionning.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
submodules: true
- name: Build the package
run: |
dotnet build ArmoniK.Extensions.Csharp.sln -c Release -p:Version=$GENVERSION
- name: Pack the package VERSION
run: |
dotnet pack ArmoniK.Extensions.Csharp.sln -c Release -o /tmp/packages -p:Version=$GENVERSION
- name: Push the package
run: |
find /tmp/packages -name 'ArmoniK*.nupkg' ! -name '*test*.nupkg' -exec dotnet nuget push {} -k ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols \;
buildImages:
runs-on: ubuntu-latest
needs:
- versionning
env:
VERSION: ${{ needs.versionning.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
- name: login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_LOGIN }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Build and push
run: docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --push=true -t dockerhubaneo/armonik_worker_dll:${VERSION} -f Worker/src/DLLWorker/Dockerfile ./
testEndToEnd:
needs:
- versionning
- buildProjects
- buildImages
strategy:
fail-fast: false
matrix:
tls: [true, false]
mtls: [true, false]
sslvalidation : [enable, disable]
useca : [true, false]
exclude:
- sslvalidation : enable
tls : false
- tls: false
mtls: true
- useca: true
sslvalidation : disable
name: "End2End tls:${{ matrix.tls }} mtls:${{ matrix.mtls }} val:${{ matrix.sslvalidation }} ca:${{ matrix.useca }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Install Dependencies
uses: aneoconsulting/ArmoniK.Action.Deploy/dependencies@main
with:
docker: true
terraform: true
k3s: true
aws: true
- name: Checkout Infra
uses: actions/checkout@v3
with:
repository: aneoconsulting/ArmoniK
path: infra
- id: deploy
name: Deploy
uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main
with:
working-directory: ${{ github.workspace }}/infra
type: localhost
tls: ${{ matrix.tls }}
mtls: ${{ matrix.mtls }}
ext-csharp-version: ${{ needs.versionning.outputs.version }}
core-version: 0.24.0
- name: Setup hosts file
run : echo -e "$(kubectl get svc ingress -n armonik -o jsonpath={.status.loadBalancer.ingress[0].ip})\tarmonik.local" | sudo tee -a /etc/hosts
- name: Add CA to store
if: ${{ (matrix.sslvalidation == 'enable') && (matrix.useca == false) }}
run: |
sudo apt install ca-certificates
sudo mkdir -p /usr/local/share/ca-certificates/
sudo cp ${{ steps.deploy.outputs.generated-folder }}/certificates/ingress/ca.crt /usr/local/share/ca-certificates/ca.crt
sudo update-ca-certificates
- name: Build and deploy EndToEnd.Tests
timeout-minutes: 15
run: |
cd Tests
mkdir -p ${HOME}/data
bash -x ./endToEndTests.sh -b -d
cd -
- name: Run tests
timeout-minutes: 18
run: |
set -ex
kubectl get svc -n armonik -o wide
export CPPort=$(kubectl get svc ingress -n armonik -o custom-columns="PORT:.spec.ports[1].port" --no-headers=true)
if [ "${{ matrix.tls }}" = "true" ]; then
export Grpc__Endpoint=https://armonik.local:$CPPort
else
export Grpc__Endpoint=http://armonik.local:$CPPort
fi
export Grpc__SSLValidation=${{ matrix.sslvalidation }}
if [ "${{ matrix.useca }}" = "true" ]; then
export Grpc__CaCert="${{ steps.deploy.outputs.generated-folder }}/certificates/ingress/ca.crt"
fi
if [ "${{ matrix.mtls }}" = "true" ]; then
export Grpc__ClientP12="${{ steps.deploy.outputs.generated-folder }}/certificates/ingress/client.submitter.p12"
fi
dotnet test --runtime linux-x64 -f net6.0 --logger "trx;LogFileName=test-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: "IntegrationTests tls:${{ matrix.tls }} mtls:${{ matrix.mtls }} val:${{ matrix.sslvalidation }} ca:${{ matrix.useca }}"
path: ./Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Client/TestResults/test-results.trx
reporter: dotnet-trx
- name: Show logs
if: always()
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
AWS_DEFAULT_OUTPUT: json
run: |
set -e
cd infra
mkdir -p end2end/infra/generated \
end2end/infra/tfstates \
end2end/app
if [ -e infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json ] ; then
cp infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json end2end/infra/generated
fi
cp infrastructure/quick-deploy/localhost/all-in-one/generated/terraform.tfstate end2end/infra/tfstates
sudo cp -rL /var/log/pods/armonik_* end2end/app
sudo chown $USER -R end2end
tar -czf end2end-${{ matrix.tls }}-${{ matrix.mtls }}-${{ matrix.sslvalidation }}-${{ matrix.useca }}.tar.gz end2end
aws s3 cp end2end-${{ matrix.tls }}-${{ matrix.mtls }}-${{ matrix.sslvalidation }}-${{ matrix.useca }}.tar.gz s3://${{ secrets.AWS_LOG_BUCKET_NAME }}/extcsharp-pipeline/${{ github.run_number }}/${{ github.run_attempt }}/end2end-${{ matrix.tls }}-${{ matrix.mtls }}-${{ matrix.sslvalidation }}-${{ matrix.useca }}.tar.gz
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: end2end-${{ matrix.tls }}-${{ matrix.mtls }}-${{ matrix.sslvalidation }}-${{ matrix.useca }}.tar.gz
path: end2end-${{ matrix.tls }}-${{ matrix.mtls }}-${{ matrix.sslvalidation }}-${{ matrix.useca }}.tar.gz
retention-days: 2
test-container:
runs-on: ubuntu-latest
needs:
- versionning
- buildImages
env:
VERSION: ${{ needs.versionning.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Install Dependencies
uses: aneoconsulting/ArmoniK.Action.Deploy/dependencies@main
with:
docker: true
terraform: true
k3s: true
aws: true
- name: Checkout Infra
uses: actions/checkout@v3
with:
repository: aneoconsulting/ArmoniK
path: infra
- name: Build Docker image
run: |
docker buildx build --tag test_image:latest --platform=linux/amd64 --build-arg WORKER_DLL_IMAGE=dockerhubaneo/armonik_worker_dll:$VERSION -f Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker/Dockerfile --load .
docker save "test_image:latest" | sudo k3s ctr images import /dev/stdin
- name: Change version
run: |
cp tools/parameters.tfvars ${{ github.workspace }}/infra/infrastructure/quick-deploy/localhost/all-in-one/parameters.tfvars
cat ${{ github.workspace }}/infra/versions.tfvars.json | jq --arg version "${{ needs.versionning.outputs.version }}" '.armonik_versions.extcsharp=$version | .armonik_images.extcsharp=["test_image"]' > .versions.tfvars.json
mv .versions.tfvars.json ${{ github.workspace }}/infra/versions.tfvars.json
- id: deploy
name: Deploy
uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main
with:
working-directory: ${{ github.workspace }}/infra
type: localhost
ext-csharp-version: ${{ needs.versionning.outputs.version }}
core-version: 0.24.0
- name: Run Test
timeout-minutes: 20
run: |
cd Tests
bash -x ./endToEndTests.sh
canMerge:
needs:
- testEndToEnd
runs-on: ubuntu-latest
steps:
- name: Echo OK
run: echo OK