Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Update compile-test.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Eason Lu <[email protected]>
  • Loading branch information
aelnosu authored Sep 12, 2023
1 parent 67d72b1 commit 61157d0
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/compile-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,27 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check for C++ files
id: check_cpp_files
run: |
if [ -z "$(find . -name '*.cpp')" ]; then
echo "No C++ files found"
echo "{cpp_files}={false}" >> "$GITHUB_ENV"
else
echo "C++ files found"
echo "{cpp_files}={true}" >> "$GITHUB_ENV"
fi

- name: Install C++ compilers
if: ${{env.cpp_files == 'true'}}
run: |
sudo apt install -y g++
sudo apt install -y clang
sudo apt install -y llvm
- name: Compile C++ code (C++14)
if: ${{env.cpp_files == 'true'}}
run: g++ -std=c++14 -Wall -Wextra -Werror -pedantic -c *.cpp
run: g++ -std=c++14 -Wall -Wextra -Werror -pedantic -c password.cpp

- name: Compile C++ code (C++17)
if: ${{env.cpp_files == 'true'}}
run: g++ -std=c++17 -Wall -Wextra -Werror -pedantic -c *.cpp
run: g++ -std=c++17 -Wall -Wextra -Werror -pedantic -c password.cpp

- name: Compile C++ code (C++20)
if: ${{env.cpp_files == 'true'}}
run: g++ -std=c++20 -Wall -Wextra -Werror -pedantic -c *.cpp
run: g++ -std=c++20 -Wall -Wextra -Werror -pedantic -c password.cpp

- name: Compile C++ code (C++23)
if: ${{env.cpp_files == 'true'}}
run: g++ -std=c++23 -Wall -Wextra -Werror -pedantic -c *.cpp
run: g++ -std=c++23 -Wall -Wextra -Werror -pedantic -c password.cpp

- name: Upload build artifact
if: ${{env.cpp_files == 'true'}} && success()
if: success()
uses: actions/upload-artifact@v3
with:
name: build-artifact
Expand Down

0 comments on commit 61157d0

Please sign in to comment.