diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..e323326 --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,23 @@ +name: C/C++ CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: configure + run: ./configure + - name: make + run: make + - name: make check + run: make check + - name: make distcheck + run: make distcheck diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..169abba --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,18 @@ +pipeline { + agent any + stages { + stage('code pushed to github') { + steps { + echo 'Commit created to repository' + writeFile(file: 'output.txt', text: 'Se ha lanzado desde jenkins', encoding: 'UTF-8') + } + } + + stage('secondary') { + steps { + mail(subject: 'Jenkins step', body: 'Testing', to: 'daniel.gallo1989@gmail.com') + } + } + + } +} \ No newline at end of file diff --git a/code/AbstractFactory/main.cpp b/code/AbstractFactory/main.cpp index 5dc6653..120d13a 100644 --- a/code/AbstractFactory/main.cpp +++ b/code/AbstractFactory/main.cpp @@ -8,18 +8,28 @@ using namespace std; int main(int argc, char *argv[]) { + //Create factory1 AbstractFactory * fc = new ConcreteFactory1(); + + //Create products A and B from factory1 AbstractProductA * pa = fc->createProductA(); AbstractProductB * pb = fc->createProductB(); + + //Use products A and B from factory1 pa->use(); pb->eat(); + //Create factory2 AbstractFactory * fc2 = new ConcreteFactory2(); + //Create products A and B from factory2 AbstractProductA * pa2 = fc2->createProductA(); AbstractProductB * pb2 = fc2->createProductB(); + //Use products A and B from factory2 pa2->use(); pb2->eat(); + + //Delete created objects for avoiding memory leaks delete fc; delete pa; delete pb; @@ -27,5 +37,6 @@ int main(int argc, char *argv[]) delete pa2; delete pb2; + //return exit code return 0; } diff --git a/code/Singleton/Singleton.h b/code/Singleton/Singleton.h index a877efc..c7eada8 100644 --- a/code/Singleton/Singleton.h +++ b/code/Singleton/Singleton.h @@ -15,12 +15,16 @@ class Singleton virtual ~Singleton(); Singleton *m_Singleton; + //Entry point to method is static and public static Singleton* getInstance(); + + //This function represents the actual operation performed over the object void singletonOperation(); private: static Singleton * instance; + //Constructor shall be declared as private Singleton(); }; diff --git a/code/main/main.cpp b/code/main/main.cpp index 3cdcdbb..8f25ba5 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -1,5 +1,6 @@ #include + using namespace std; int main(int argc, char *argv[])