[38ba34]: / .github / workflows / create-compare-reference.yml

Download this file

103 lines (82 with data), 3.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
name: Create compare reference
on:
# push:
# tags:
# - 'ammr-*'
workflow_dispatch:
inputs:
git_reference:
description: 'Which Git reference to check out. Examples: "refs/tags/v0.2.1", "refs/heads/master".'
default: refs/tags/vX.Y.Z
required: true
concurrency:
group: compare-test-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
if: github.repository_owner == 'anybody'
runs-on: [self-hosted, Windows, AnyBody]
strategy:
matrix:
include:
- ams_version: "7.5_Beta"
env:
ANYBODYCON: C:\Program Files\AnyBody Technology\AnyBody.${{ matrix.ams_version }}\AnyBodyCon.exe
steps:
- name: Set variables
env:
DEFAULT_GIT_REFERENCE: refs/heads/master
run: |
$GIT_REFERENCE="${{ github.event.inputs.git_reference || env.DEFAULT_GIT_REFERENCE }}"
echo "GIT_REFERENCE=$GIT_REFERENCE" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
echo "COMPARE_TEST_NAME=$($GIT_REFERENCE.replace("/","-"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Checkout repository at ${{ env.GIT_REFERENCE }}
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_REFERENCE }}
fetch-depth: 0
- uses: prefix-dev/setup-pixi@v0.8.7
with:
environments: test
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
post-cleanup: true
activate-environment: test
- name: Store AMS Version
run: |
$AMS_VERSION = $(pixi run python -c "import anypytools; print(anypytools.tools.anybodycon_version('${{ env.ANYBODYCON }}'))")
echo "AMS_VERSION=$AMS_VERSION" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Run test for compare
run: |
cd Tests
pytest --runslow --anytest-output=${{runner.temp}} --anytest-name=${{ env.GIT_REFERENCE }} --anybodycon="$Env:ANYBODYCON"
- name: Compress compare data
working-directory: ${{runner.temp}}
run: |
Compress-Archive -Force -Path ${{ env.GIT_REFERENCE }}/* -DestinationPath compare-data.zip
- name: Create Upload script
working-directory: ${{runner.temp}}
run: |
$script = @"
import os
import sys
from azure.storage.blob import BlobServiceClient
version = os.environ["AMS_VERSION"].partition(" (")[0].replace(" ", "")
container_name = f"ams-{version.replace('.','-')}"
blob_name = os.environ["AZURE_BLOB_NAME"]
container_client = BlobServiceClient.from_connection_string(
os.environ["AZURE_CONN_STR"]
).get_container_client(container_name)
if not container_client.exists():
container_client.create_container()
with open(sys.argv[1], "rb") as fh:
container_client.upload_blob(blob_name, fh, overwrite=True)
"@ | Set-Content -Path "upload.py"
- name: Upload to azure
working-directory: ${{runner.temp}}
env:
AZURE_CONN_STR: ${{ secrets.AZURE_CONN_STR }}
AZURE_BLOB_NAME: ${{ env.COMPARE_TEST_NAME }}
run: |
echo $env:AZURE_BLOB_NAME
echo $env:AZURE_CONTAINER_NAME
python upload.py compare-data.zip