Use python to update failure logs.

This commit is contained in:
Matthieu Gautier 2023-11-30 11:32:38 +01:00
parent 3c9671bd0b
commit 72b2cf964f
3 changed files with 23 additions and 21 deletions

18
.github/scripts/upload_failure_logs.py vendored Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
import tarfile
from pathlib import Path
from common import upload, OS_NAME, PLATFORM_TARGET, HOME
ARCHIVE_NAME = Path(f"fail_log_{OS_NAME}_{PLATFORM_TARGET}.tar.gz")
files_to_archive = []
files_to_archive += HOME.glob("BUILD_*")
files_to_archive += [HOME/"SOURCE", HOME/"LOGS", HOME/"TOOLCHAINS"]
with tarfile.open(ARCHIVE_NAME, "w:xz") as tar:
for name in set(files_to_archive):
tar.add(str(name))
upload(ARCHIVE_NAME, "ci@tmp.kiwix.org:30022", "/data/tmp/ci")

View File

@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -e
cd $HOME
ARCHIVE_NAME=fail_log_${OS_NAME}_${COMPILE_CONFIG}.tar.gz
tar -czf ${ARCHIVE_NAME} $HOME/BUILD_* $HOME/SOURCE $HOME/LOGS $HOME/TOOLCHAINS
echo "Uploading archive $ARCHIVE_NAME"
scp -c aes128-ctr -P 30022 -p -i ${SSH_KEY} \
-o PasswordAuthentication=no \
-o StrictHostKeyChecking=no \
$ARCHIVE_NAME \
ci@tmp.kiwix.org:/data/tmp/ci

View File

@ -13,6 +13,7 @@ jobs:
env: env:
OS_NAME: windows OS_NAME: windows
PLATFORM_TARGET: native_dyn PLATFORM_TARGET: native_dyn
HOME: 'C:\\Users\\runneradmin'
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -51,9 +52,8 @@ jobs:
env: env:
SSH_KEY: ${{ runner.temp }}/id_rsa SSH_KEY: ${{ runner.temp }}/id_rsa
- name: Upload failure logs - name: Upload failure logs
shell: bash
if: failure() if: failure()
run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.sh run: python .github\\scripts\\upload_failure_logs.py
Linux: Linux:
strategy: strategy:
@ -144,7 +144,7 @@ jobs:
COMPILE_CONFIG: ${{matrix.config}} COMPILE_CONFIG: ${{matrix.config}}
- name: Upload failure logs - name: Upload failure logs
if: failure() if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.py
env: env:
COMPILE_CONFIG: ${{matrix.config}} COMPILE_CONFIG: ${{matrix.config}}
@ -190,7 +190,7 @@ jobs:
kiwix-build/.github/scripts/build_projects.py kiwix-build/.github/scripts/build_projects.py
- name: Upload failure logs - name: Upload failure logs
if: failure() if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.py
Macos: Macos:
strategy: strategy:
@ -256,6 +256,6 @@ jobs:
COMPILE_CONFIG: ${{matrix.config}} COMPILE_CONFIG: ${{matrix.config}}
- name: Upload failure logs - name: Upload failure logs
if: failure() if: failure()
run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.sh run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.py
env: env:
COMPILE_CONFIG: ${{matrix.config}} COMPILE_CONFIG: ${{matrix.config}}