Skip to content

Commit

Permalink
Use python to update failure logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Jun 7, 2024
1 parent bdda21f commit bea7257
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
18 changes: 18 additions & 0 deletions .github/scripts/upload_failure_logs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

import tarfile
from pathlib import Path
from common import upload, OS_NAME, COMPILE_CONFIG, HOME

ARCHIVE_NAME = Path(f"fail_log_{OS_NAME}_{COMPILE_CONFIG}.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, "[email protected]:30022", "/data/tmp/ci")
16 changes: 0 additions & 16 deletions .github/scripts/upload_failure_logs.sh

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
env:
OS_NAME: windows
COMPILE_CONFIG: native_dyn
HOME: 'C:\\Users\\runneradmin'
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -54,10 +55,9 @@ jobs:
env:
SSH_KEY: ${{ runner.temp }}/id_rsa
- name: Upload failure logs
shell: bash
if: failure()
run: |
$GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.sh
python .github\\scripts\\upload_failure_logs.py
env:
SSH_KEY: ${{ runner.temp }}/id_rsa

Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
COMPILE_CONFIG: ${{matrix.config}}
- name: Upload failure logs
if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.py
env:
COMPILE_CONFIG: ${{matrix.config}}

Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
kiwix-build/.github/scripts/build_projects.py
- name: Upload failure logs
if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.py

Macos:
strategy:
Expand Down Expand Up @@ -262,6 +262,6 @@ jobs:
COMPILE_CONFIG: ${{matrix.config}}
- name: Upload failure logs
if: failure()
run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.sh
run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.py
env:
COMPILE_CONFIG: ${{matrix.config}}

0 comments on commit bea7257

Please sign in to comment.