├── .github └── workflows │ └── main.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── action-a ├── Dockerfile ├── script1.sh └── src.cpp └── action.yml /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: OpenGL Output 2 | on: push 3 | 4 | jobs: 5 | build: 6 | name: OpenGL 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@master 10 | - uses: ./action-a 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Collaborate: 2 | 3 | 1. Fork the repository to your own GitHub account. 4 | 5 | 2. Clone the repository to your local machine 6 | ``` 7 | $ git clone "https://www.github.com/{Username}/OpenGL_Actions.git" 8 | ``` 9 | where username is your GitHub account username. 10 | 11 | 3. Create a branch where you can do your local work. 12 | Never work on **master** branch as we do not allow master commits except by admins. 13 | ``` 14 | $ git branch {branchname} 15 | $ git checkout branchname 16 | ``` 17 | 18 | 4. Do your work and stage your changes. 19 | ``` 20 | $ git add 21 | ``` 22 | 23 | 5. Commit you changes with a commit message containing your name, file(s) worked upon, changes added. 24 | ``` 25 | $ git commit -m "Name| files| Changes" 26 | ``` 27 | 28 | 6. Push changes to your forked repository 29 | ``` 30 | $ git push -u origin branchname 31 | ``` 32 | 7. Create a pull request to the upstream repository. 33 | 34 | # Synchronize forked repository with Upstream repository 35 | 36 | 1. Create upstream as our repository 37 | ``` 38 | $ git remote add upstream "https://www.github.com/NishkarshRaj/OpenGL_Actions" 39 | ``` 40 | 41 | 2. Fetch upstream changes in local machine 42 | ``` 43 | $ git fetch upstream 44 | ``` 45 | 46 | 3. Switch to master branch 47 | ``` 48 | $ git checkout master 49 | ``` 50 | 51 | 4. Merge changes in local machine 52 | ``` 53 | $ git merge upstream/master 54 | ``` 55 | 56 | 5. Push changes to your forked GitHub repository 57 | ``` 58 | $ git push -f origin master 59 | ``` 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Nishkarsh Raj 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenGL_Actions 2 | 3 | Use GitHub Actions to complile C/C++ source codes to generate OpenGL output. 4 | 5 | ## How to use: 6 | 7 | 1. Add a .cpp/.c source file in action-a/ folder. 8 | 2. Add the file name in both Dockerfile and script file replacing the default src.cpp file 9 | 3. push to the master branch to run the action 10 | 11 | ## How to contribute 12 | 13 | This project is open sourced and contributions in all forms are welcomed. 14 | 15 | Please follow these [guidelines](CONTRIBUTING.md) for contributing to this repository. 16 | 17 | ## License 18 | 19 | This project is [MIT](LICENSE) licensed. Created by @NishkarshRaj 20 | -------------------------------------------------------------------------------- /action-a/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | RUN apt-get -y update 3 | RUN apt-get -y install apt-utils 4 | RUN apt-get -y install g++ 5 | RUN apt-get -y install freeglut3-dev 6 | ADD script1.sh /script1.sh 7 | ADD src.cpp /Hut.cpp 8 | RUN chmod +x /script1.sh 9 | CMD /script1.sh 10 | -------------------------------------------------------------------------------- /action-a/script1.sh: -------------------------------------------------------------------------------- 1 | g++ action-a/src.cpp -lglut -lGLU -lGL; 2 | -------------------------------------------------------------------------------- /action-a/src.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | void init() 6 | { 7 | // Set display window color to as glClearColor(R,G,B,Alpha) 8 | glClearColor(1.0, 0.0, 0.0, 1.0); 9 | // Set projection parameters. 10 | glMatrixMode(GL_PROJECTION); 11 | // Set 2D Transformation as gluOrtho2D(Min Width, Max Width, Min Height, Max Height) 12 | gluOrtho2D(0.0, 700, 0.0, 700); 13 | } 14 | void display() 15 | { 16 | glClear( GL_COLOR_BUFFER_BIT ); 17 | //glColor3f(0.1, 0.5, 0.0); 18 | glBegin( GL_TRIANGLES ); 19 | glVertex2i( 200,400 ); 20 | glVertex2i( 400,400 ); 21 | glVertex2i( 300,600 ); 22 | glEnd(); 23 | glFlush(); 24 | } 25 | int main(int argc, char**argv) 26 | { 27 | glutInit(&argc, argv); 28 | glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB ); 29 | glutInitWindowSize( 700,700 ); 30 | glutCreateWindow("Nishkarsh"); 31 | init(); //Important to initialize 32 | glutDisplayFunc(display); 33 | glutMainLoop(); //See screen for long time similar to getch 34 | } 35 | 36 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'OpenGL Actions' 2 | description: 'Create OpenGL output for code using Freeglut package on Ubuntu' 3 | author: 'Nishkarsh Raj' 4 | inputs: 5 | src: 6 | description: '.cpp file put in action-a/' 7 | runs: 8 | using: 'docker' 9 | image: 'Dockerfile' 10 | branding: 11 | icon: 'check-circle' 12 | color: 'green' 13 | --------------------------------------------------------------------------------