Add clang-format
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Sebastian Ranoszek 2025-04-04 19:20:36 +02:00
parent 34a838be7b
commit 6bf852f010
2 changed files with 16 additions and 37 deletions

View file

@ -1,4 +1,11 @@
steps: steps:
- name: Format-Code
image: alpine
commands:
- apk add --no-cache g++ libc-dev git clang clang-extra-tools
- echo "Formatting project..."
- find ./ -type f -name "*.cpp" -o -name "*.h" | xargs clang-format -i
- name: Build - name: Build
image: alpine image: alpine
commands: commands:
@ -7,6 +14,8 @@ steps:
- echo "Building project..." - echo "Building project..."
- g++ -O2 -static -o build/main main.cpp - g++ -O2 -static -o build/main main.cpp
- chmod +x build/main - chmod +x build/main
depends_on:
- Format-Code
- name: Check Static - name: Check Static
image: alpine image: alpine
@ -25,14 +34,6 @@ steps:
depends_on: depends_on:
- Build - Build
- name: Test-Arch
image: archlinux/archlinux
commands:
- pacman -Sy --noconfirm bash glibc
- bash -c "./build/main"
depends_on:
- Build
- name: discord notification - name: discord notification
image: appleboy/drone-discord image: appleboy/drone-discord
settings: settings:
@ -46,17 +47,18 @@ steps:
{{/success}} {{/success}}
depends_on: depends_on:
- Build - Build
- Test-Arch
- Test-Debian - Test-Debian
- name: Confirm-Build - name: Confirm-Build
image: alpine image: alpine
commands: commands:
- echo "Checking for changes..."
- git add .
- git diff --cached --quiet || (git commit -m "Apply clang-format changes [skip ci]" && git push origin HEAD)
- ls -al build - ls -al build
- echo "Build is mint!" - echo "Build is mint!"
depends_on: depends_on:
- Build - Build
- Test-Arch
- Test-Debian - Test-Debian
- name: Release - name: Release

View file

@ -1,29 +1,6 @@
#include <iostream> #include <iostream>
using namespace std; using namespace std;
int main() { int i,n; float suma; int f0=0,f1=1; float zl;
int main() { cout << "N = "; cin >> n; cout << f0 << " " << f1 << " ";
int i,n; for(i=2;i<=n;i++) { suma=f0+f1; cout << suma << " "; f0=f1; f1=suma; }
float suma; zl=suma/f0; cout << "\nZlota liczba = " << zl << endl; return 0; }
int f[100], f0, f1;
float zl;
cout << "N = ";
cin >> n;
f0 = 0;
f1 = 1;
cout << f0 << " " << f1 << " ";
for(i = 2;i<=n;i++) {
suma = f0 + f1;
cout << suma << " ";
f0 = f1;
f1 = suma;
}
zl = suma/f0;
cout << "\nZlota liczba = " << zl << endl;
system("pause");
return 0;
}