Add support for any command wrapper, not just strace #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Wrapper Action | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test-basic: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Test wrapper with a simple action (no wrapper) | |
| uses: ./ | |
| with: | |
| action-ref: "actions/hello-world-javascript-action@main" | |
| enable-wrapper: "false" | |
| input-who-to-greet: "World" | |
| test-strace: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install strace and set permissions | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y strace | |
| # Set permissions to allow strace to work without privilege issues | |
| echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope || true | |
| - name: Test wrapper with strace | |
| id: strace-test | |
| uses: ./ | |
| with: | |
| action-ref: "actions/hello-world-javascript-action@main" | |
| wrapper-command: "strace -f -v -s 256 -e trace=file,process,network,signal,ipc,desc,memory" | |
| input-who-to-greet: "Strace" | |
| - name: Check strace output | |
| run: | | |
| if [ -f "${{ steps.strace-test.outputs.wrapper-log }}" ]; then | |
| echo "Wrapper log file exists at ${{ steps.strace-test.outputs.wrapper-log }}" | |
| head -n 20 "${{ steps.strace-test.outputs.wrapper-log }}" | |
| else | |
| echo "Wrapper log file not found!" | |
| exit 1 | |
| fi | |
| - name: Upload strace logs as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: strace-logs | |
| path: ${{ steps.strace-test.outputs.wrapper-log }} | |
| test-time: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Test wrapper with time command | |
| id: time-test | |
| uses: ./ | |
| with: | |
| action-ref: "actions/hello-world-javascript-action@main" | |
| wrapper-command: "time -v" | |
| input-who-to-greet: "Time" | |
| - name: Check time output | |
| run: | | |
| if [ -f "${{ steps.time-test.outputs.wrapper-log }}" ]; then | |
| echo "Time log file exists at ${{ steps.time-test.outputs.wrapper-log }}" | |
| cat "${{ steps.time-test.outputs.wrapper-log }}" | |
| else | |
| echo "Time log file not found!" | |
| exit 1 | |
| fi | |
| - name: Upload time logs as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: time-logs | |
| path: ${{ steps.time-test.outputs.wrapper-log }} |