Skip to content

Create a workflow for testing LFC.sh #1

Description

@SolitudePy

Create a workflow for running LFC.sh and checking if it ran successfully.
There was a try to do it before, however unsuccessful due to script hanging:

name: LFC Script CI

on:
  push:
    branches: [main]
  pull_request:
    branches: ["*"]

jobs:
  test_lfc_script:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Make LFC.sh executable
        run: chmod +x LFC/LFC.sh

      - name: Run LFC.sh and verify output
        run: |
          set -e
          OUTPUT_DIR="/tmp/lfc_output"
          TARBALL="/tmp/lfc_output.tar.gz"
          EXTRACT_DIR="/tmp/extracted_output"
          sudo ./LFC/LFC.sh "$OUTPUT_DIR"
          mkdir -p "$EXTRACT_DIR"
          tar -xzf "$TARBALL" -C "$EXTRACT_DIR"

          LOG_FILE_PATH="$EXTRACT_DIR/$(basename "$OUTPUT_DIR")/log_file.log"
          if [ -f "$LOG_FILE_PATH" ]; then
            echo "log_file.log found."
            if grep -q "Artifact collection completed" "$LOG_FILE_PATH"; then
              echo "Artifact collection completed message found in log."
            else
              echo "Error: Artifact collection completed message NOT found in log."
              cat "$LOG_FILE_PATH"
              exit 1
            fi
          else
            echo "Error: log_file.log not found."
            ls -R "$EXTRACT_DIR"
            exit 1
          fi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions