diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2b2d36b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: C++ Build + +on: + push: + branches: [ main, master, practice-branch ] + pull_request: + branches: [ main, master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install C++ compiler + run: | + sudo apt-get update + sudo apt-get install -y g++ + + - name: Build project + run: | + if [ -f main.cpp ]; then + g++ -o main main.cpp + echo "Build successful" + else + echo "No main.cpp found, skipping build" + fi diff --git a/README.md b/README.md index bfbdeec..60ee683 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ +[![C++ Build](https://github.com/sesantilla/git-practice/actions/workflows/build.yml/badge.svg)](https://github.com/sesantilla/git-practice/actions/workflows/build.yml) # git-practice -This is a typo: -Remove this and replace it with this text: HEY! You should read me! I'm a README.md file! diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..d511650 --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include + +// This is a simple C++ program that prints "Hello, World!" to the console. +main () +{ + // Output "Hello, World!" to the console + std::cout << "Hello, World!" << std::endl; + + // Return 0 to indicate that the program ended successfully + return 0; +} \ No newline at end of file