mirror of
https://github.com/johndoe6345789/GithubWorkflowTool.git
synced 2026-04-24 13:45:02 +00:00
Add documentation, examples, and fix missing includes
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
53
examples/README.md
Normal file
53
examples/README.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Example Workflows
|
||||
|
||||
This directory contains example GitHub Actions workflow files that can be used to test the GithubWorkflowTool.
|
||||
|
||||
## example-workflow.yml
|
||||
|
||||
A comprehensive example workflow that demonstrates:
|
||||
|
||||
1. **Multiple Triggers**:
|
||||
- Push events on main and develop branches
|
||||
- Pull request events
|
||||
- Manual workflow_dispatch
|
||||
|
||||
2. **Global Environment Variables**:
|
||||
- `BUILD_TYPE` set to Release
|
||||
|
||||
3. **Multiple Jobs with Dependencies**:
|
||||
- `build`: Initial build and test job
|
||||
- `test-matrix`: Matrix strategy testing (needs build)
|
||||
- `deploy`: Deployment job (needs both build and test-matrix)
|
||||
|
||||
4. **Matrix Strategy**:
|
||||
- Tests with multiple compilers (gcc, clang)
|
||||
- Tests with multiple build types (Debug, Release)
|
||||
|
||||
5. **Common Actions**:
|
||||
- `actions/checkout@v3`
|
||||
- `actions/upload-artifact@v3`
|
||||
|
||||
6. **Conditional Execution**:
|
||||
- Deploy job only runs on main branch
|
||||
|
||||
## Testing with GithubWorkflowTool
|
||||
|
||||
### Using CLI:
|
||||
```bash
|
||||
# Discover workflows in this directory
|
||||
./build/gwt workflows examples/
|
||||
|
||||
# Run the example workflow
|
||||
./build/gwt run examples/ examples/example-workflow.yml
|
||||
|
||||
# Run with QEMU backend
|
||||
./build/gwt run examples/ examples/example-workflow.yml --qemu
|
||||
```
|
||||
|
||||
### Using GUI:
|
||||
1. Launch the GUI: `./build/gwt-gui`
|
||||
2. Click "Clone Repository" (or use File > Open for local directory)
|
||||
3. Select the examples directory
|
||||
4. Select the workflow from the list
|
||||
5. Choose backend (Container or QEMU)
|
||||
6. Click "Run Workflow"
|
||||
72
examples/example-workflow.yml
Normal file
72
examples/example-workflow.yml
Normal file
@@ -0,0 +1,72 @@
|
||||
name: Example CI Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup build environment
|
||||
run: |
|
||||
echo "Setting up build environment"
|
||||
sudo apt-get update
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
echo "Configuring project"
|
||||
cmake -B build -G Ninja
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
echo "Building project"
|
||||
cmake --build build
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
echo "Running tests"
|
||||
cd build && ctest
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: build/
|
||||
|
||||
test-matrix:
|
||||
name: Test Matrix
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [gcc, clang]
|
||||
build_type: [Debug, Release]
|
||||
|
||||
steps:
|
||||
- name: Test ${{ matrix.compiler }} - ${{ matrix.build_type }}
|
||||
run: |
|
||||
echo "Testing with ${{ matrix.compiler }} in ${{ matrix.build_type }} mode"
|
||||
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build, test-matrix]
|
||||
if: github.ref == 'refs/heads/main'
|
||||
|
||||
steps:
|
||||
- name: Deploy application
|
||||
run: |
|
||||
echo "Deploying application"
|
||||
Reference in New Issue
Block a user