mirror of
https://github.com/johndoe6345789/GithubWorkflowTool.git
synced 2026-04-25 14:15:25 +00:00
73 lines
1.5 KiB
YAML
73 lines
1.5 KiB
YAML
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"
|