Fix GitHub Actions CI workflow #2
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
| # .github/workflows/ci.yml | |
| # 1. Workflow Name | |
| name: C++ CI for mygit | |
| # 2. Triggers | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| # 3. Jobs | |
| jobs: | |
| build-and-test: | |
| # 4. Runner | |
| runs-on: ubuntu-latest | |
| # 5. Steps | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake libssl-dev zlib1g-dev libcurl4-openssl-dev | |
| - name: Install cpr library | |
| run: | | |
| git clone https://github.com/libcpr/cpr.git | |
| cd cpr | |
| mkdir build && cd build | |
| cmake .. -DCPR_USE_SYSTEM_CURL=ON | |
| cmake --build . | |
| sudo cmake --install . | |
| - name: Make scripts executable | |
| run: | | |
| chmod +x build.sh | |
| chmod +x tests/*.sh | |
| - name: Build the project | |
| run: ./build.sh | |
| # CORRECTED STEP: Run tests from within the 'tests' directory | |
| - name: Run tests | |
| # This tells the runner to execute the following command | |
| # inside the 'tests' directory. | |
| working-directory: ./tests | |
| run: ./run_all_tests.sh |