Skip to content

Commit

Permalink
Update CI system (#797)
Browse files Browse the repository at this point in the history
* Add CI steps to specify which AnyBodyCon is used
  • Loading branch information
melund committed May 16, 2023
1 parent 6acc489 commit 5b4e698
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 48 deletions.
42 changes: 42 additions & 0 deletions .github/actions/custom-anybodycon/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This aciton will only work on Windows runners

name: 'Use Custom AnyBodyCon from Azure Blob storage'

description: 'Download specific anybodycon version from Azure Blob storage'

inputs:
custom-anybodycon: # path
description: 'The AnyBodyCon version to use'
required: true
connection-string:
description: 'The connection string to the Azure Blob storage'
required: true

runs:
using: "composite"
steps:
- name: Create temp location for AnyBodyCon
if: ${{ inputs.custom-anybodycon }}
shell: powershell
run: mkdir -p ${{ runner.temp }}/$(split-path ${{ inputs.custom-anybodycon }} -Parent)

- name: Get special AnyBodyCon version
if: ${{ inputs.custom-anybodycon }}
uses: armanrahman22/azblob-download-action@main
with:
connection-string: ${{ inputs.connection-string }}
container-name: "anybodycon"
blob-name: ${{ inputs.custom-anybodycon }}
download-path: ${{ runner.temp }}

- name: Overwrite AnyBodyCon
if: ${{ inputs.custom-anybodycon }}
shell: powershell
run: |
cp ${{ runner.temp }}\${{ inputs.custom-anybodycon }} "$(split-path $Env:ANYBODYCON -Parent)/AnyBodyConCustom.any"
echo "ANYBODYCON=$(split-path $Env:ANYBODYCON -Parent)\AnyBodyConCustom.any" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
41 changes: 41 additions & 0 deletions .github/actions/setup-micromamba/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This aciton will only work on Windows runners

name: 'Install Micro mamba'

description: 'Download and install micromamba on the selfhosted runner'

inputs:
environment-file: # path
description: 'A conda environment file to install'
required: false
default: ''
environment-name:
description: 'The name of the conda environment to create'
required: false
default: ''

runs:
using: "composite"
steps:
- name: Install conda
shell: powershell
run: |
Invoke-Webrequest -URI https://anaconda.org/conda-forge/micromamba/1.4.3/download/win-64/micromamba-1.4.3-0.tar.bz2 -OutFile ~\micromamba.tar.bz2
if ((Get-FileHash ~\micromamba.tar.bz2).hash -ne "173D2A8DD8E324611FA7331992896EBF7EA2F953C61559C10772EE377AF27D05") {exit 1}
$env:Path = "C:\PROGRA~1\Git\usr\bin;" + $env:Path
tar -xvjf ~/micromamba.tar.bz2 --strip-components 2 -C ~ Library/bin/micromamba.exe
echo "MAMBA_ROOT_PREFIX=$HOME\micromamba" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Create conda environment (custom name)
if: inputs.environment-file != '' && inputs.environment-name != ''
shell: powershell
run: |
~\micromamba.exe shell hook -s powershell | Out-String | iex
micromamba create --allow-downgrade -y -n ${{ inputs.environment-name }} -f ${{ inputs.environment-file }}
- name: Create conda environment
if: inputs.environment-file != '' && inputs.environment-name == ''
shell: powershell
run: |
~\micromamba.exe shell hook -s powershell | Out-String | iex
micromamba create --allow-downgrade -y -f ${{ inputs.environment-file }}
30 changes: 7 additions & 23 deletions .github/workflows/nighly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ name: Nightly Full AMMR tests
on:
schedule:
- cron: 0 3 * * *
workflow_dispatch:
inputs:
debug_config:
description: 'A debug environment varibles which is set when running tests.'
required: false
default: ""
workflow_dispatch: {}


concurrency:
Expand Down Expand Up @@ -37,29 +32,18 @@ jobs:
ShortestPathMaxAngle: 0.3491
ANYBODYCON: C:\Program Files\AnyBody Technology\AnyBody.${{ matrix.ams_version }}\AnyBodyCon.exe
SuppressDeprecationMessages: ${{ matrix.suppress_deprecation_messages }}
#PYTEST_ADDOPTS: ${{contains(matrix.ams_version, 'Beta') && '--suppress-tests-failed-exit-code' || ''}}

steps:
- uses: actions/checkout@v3
with:
ref: ${{ matrix.ammr_version }}

- name: Set debug env var
run: echo "${{ github.event.inputs.debug_config }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append

- name: Install conda
run: |
Invoke-Webrequest -URI https://anybodycloudci.blob.core.windows.net/micromamba/micromamba-0.25.1-0.tar.bz2 -OutFile ~\micromamba.tar.bz2
(Get-FileHash ~\micromamba.tar.bz2).hash -eq "ED3B12B747F05A630198D3A8A8F7120BDE22AE9033CB62AF95D6F3DF57FE9B0C"
$env:Path = "C:\PROGRA~1\Git\usr\bin;" + $env:Path
tar -xvjf ~/micromamba.tar.bz2 --strip-components 2 -C ~ Library/bin/micromamba.exe
echo "MAMBA_ROOT_PREFIX=$HOME\micromamba" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Create conda environment
run: |
~\micromamba.exe shell hook -s powershell | Out-String | iex
micromamba create --allow-downgrade -y -n _ammr_test -f Tests\test-environment.yml
- name: Install micro mamba
uses: ./.github/actions/setup-micromamba
with:
environment-file: Tests/test-environment.yml
environment-name: _ammr_test

- name: Run full AMMR tests
run: |
~\micromamba.exe shell hook -s powershell | Out-String | iex
Expand Down
47 changes: 22 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ on:
description: 'Set to true to run the full tests (takes a long time)'
required: false
default: false

custom-anybodycon:
description: 'The AnyBodyCon version to use, leave empty to use the default AnyBodyCon'
required: false
default: 'AnyBody.7.5-CI-master.AnyBody.7.5.x/AnyBodyCon.exe'


concurrency:
group: ci-${{ github.ref }}
Expand All @@ -32,33 +36,26 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Install conda
run: |
Invoke-Webrequest -URI https://anybodycloudci.blob.core.windows.net/micromamba/micromamba-0.25.1-0.tar.bz2 -OutFile ~\micromamba.tar.bz2
(Get-FileHash ~\micromamba.tar.bz2).hash -eq "ED3B12B747F05A630198D3A8A8F7120BDE22AE9033CB62AF95D6F3DF57FE9B0C"
$env:Path = "C:\PROGRA~1\Git\usr\bin;" + $env:Path
tar -xvjf ~/micromamba.tar.bz2 --strip-components 2 -C ~ Library/bin/micromamba.exe
echo "MAMBA_ROOT_PREFIX=$HOME\micromamba" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Create conda environment
run: |
~\micromamba.exe shell hook -s powershell | Out-String | iex
micromamba create --allow-downgrade -y -n _ammr_test -f Tests\test-environment.yml
- name: Run fast AMMR tests
if: github.event.inputs.run-slow-tests == 'false'
run: |
~\micromamba.exe shell hook -s powershell | Out-String | iex
micromamba activate _ammr_test

pytest -n 4 --instafail --durations=20 --anybodycon="$Env:ANYBODYCON" Tests
- name: Run slow AMMR tests
if: github.event.inputs.run-slow-tests == 'true'
- name: Download custom AnyBodyCon
if: ${{ inputs.custom-anybodycon }}
uses: ./.github/actions/custom-anybodycon
with:
custom-anybodycon: ${{ inputs.custom-anybodycon }}
connection-string: ${{ secrets.AZURE_CONN_STR }}

- name: Install micro mamba
uses: ./.github/actions/setup-micromamba
with:
environment-file: Tests/test-environment.yml
environment-name: _ammr_test

- name: Run AMMR tests (${{ github.event.inputs.run-slow-tests == 'true' && 'slow' || 'fast' }} tests)
run: |
~\micromamba.exe shell hook -s powershell | Out-String | iex
micromamba activate _ammr_test
pytest -n 4 --instafail --durations=20 --anybodycon="$Env:ANYBODYCON" --runslow Tests
pytest -n 4 --instafail --durations=20 --anybodycon="$Env:ANYBODYCON" `
${{ github.event.inputs.run-slow-tests == 'true' && '--runslow' || '' }} `
Tests

0 comments on commit 5b4e698

Please sign in to comment.