diff --git a/labreports/LAB_INSTRUCTIONS.md b/LAB_INSTRUCTIONS.md similarity index 53% rename from labreports/LAB_INSTRUCTIONS.md rename to LAB_INSTRUCTIONS.md index 6be3615f..85f41397 100644 --- a/labreports/LAB_INSTRUCTIONS.md +++ b/LAB_INSTRUCTIONS.md @@ -1,32 +1,27 @@ -# CIS 411 Lab 0: GitHub + CircleCI -The purpose of this lab is to both impart/confirm a level of professional comfort working with tools like GitHub and CircleCI as well as to invite a student to consider what precisely is happening conceptually and actually (behind the scenes) in the execution of the lab. +# Lab Instructions -## Submitting work -Lab reports will be submitted by generating a markdown file in the labreports directory under the naming convention: **LAB_[GITHUB HANDLE].md**, and submitting a Pull Request to this repository that include your lab report as well as any accompanying images/files (there are diagrams required in the lab content). - -* Throughout these instructions, you'll find that **items marked in bold text** reference content you are to submit in your lab report. -* For the purposes of clear communication, you may base your lab report off of the template found in [LAB.md](LAB.md), but you're also free, welcome, and encouraged to get more creative. -* If you are unfamiliar with markdown, I recommend checking [1000 places on the Interwebs](http://lmgtfy.com/?q=learn+markdown) that will help you close that gap. - -# Step 0: Create a GitHub account++ +## Step 0: Create a GitHub account++ 1. If you don't have a GitHub account already, [create one](https://github.com/join). If you do, **record the name of your handle in your lab report** and **record a link to one repository you either follow or star**. 2. If you don't already have _git_ installed on your development machine, [do so](https://git-scm.com/downloads). -3. Install a text editor or some sort of application for local development. Lately, I'm partial to [Visual Studio Code](https://code.visualstudio.com/) and my instructions assume it's use, but you're welcome to diviate. _Each one should choose their own sword, etc. etc._ +3. Install a text editor or some sort of application for local development. Lately, I'm partial to [Visual Studio Code](https://code.visualstudio.com/) and my instructions assume it's use, but you're welcome to deviate. _Each one should choose their own sword, etc. etc._ 4. To run the project in Step 2, you'll need to have [node.js](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/cli/install) installed. -# Step 1: Fork this repository -1. After logging in, navigate to the [root](https://github.com/tangollama/cis411_lab0) of this repository. +## Step 1: Fork this repository +1. After logging in, navigate to the [purelab branch root](https://github.com/trevordbunch/cis411_lab1_CI/tree/purelab) of this repository. 2. Fork this repository to your personal GitHub account (hint: read the page). 3. **Record the URL to your forked repo in your lab report.** -4. **Generate a simple diagram** (in Google Draw or your favorite diagramming tool) that demonstrates the relationship between _this_ repository and my account (tangollama) with your account and your newly forked repository. (i.e. Is this the same thing as a source control branch or is there something unique about a fork in a distributed version control system? _Hint... I'm asking for a reason._) +4. **Generate a simple diagram** (in Google Draw or your favorite diagramming tool) that demonstrates the relationship between _this_ repository and my account (trevordbunch) with your account and your newly forked repository. (i.e. Is this the same thing as a source control branch or is there something unique about a fork in a distributed version control system? _Hint... I'm asking for a reason._ If it's helpful, think about the relationship you and another student who is conducting the fork command each has to this repository.) -# Step 2: Clone your forked repository from the command line +## Step 2: Clone your forked repository from the command line 1. Navigate to your forked repository in your GitHub account and copy the reference to your repository in from the button. -2. Open the terminal or command line interface on your development machine, navigate to your chosen working directory, and execute the following command: ```git clone [YOUR COPIED GITHUB CLONE REFERENCE]```. -3. Navigate to that directory ```cd cis411_lab0```. +2. Open the terminal or command line interface on your development machine, *navigate to your chosen working directory*, and execute the following command: ```git clone [YOUR COPIED GITHUB CLONE REFERENCE]```. +3. Navigate to that directory ```cd cis411_lab1_CI```. + +## Step 3: Run the application locally +1. If you haven't already - make sure that you have installed [node.js](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/cli/install) 4. Run ```npm install``` and watch the magic happen. 5. Run ```npm start``` and navigate to http://localhost:4000/graphql. -6. Run the following GraphQL mutation in GraphiQL and **record the response**. +6. Run the following GraphQL mutation in GraphQL and **record the response**. ``` mutation { mutateAccount(input: { @@ -40,47 +35,50 @@ mutation { } } ``` +Use Ctrl+C or Cmd+C to exit out of the node application within the terminal. -# Step 3: Creating a feature branch +## Step 4: Creating a feature branch [Branching and merging](https://www.atlassian.com/agile/software-development/branching) is a common tactic used in change management and feature development. We're going to use a branch (and eventually a merge) to build our lab report. -1. Create the branch ```git branch -c labreport```. -2. Create a lab report mardown file (ex. ```cp labreports/LAB.md labreports/LAB_[GITHUB USERNAME].md``` ). -3. Add the file to your branch ```git commit -a -m "your commit and reference @tangollama in the message"```. -4. Push the change to GitHub ```git push -u origin labreport```. -5. As you make additional changes to the lab report, commit and push at least one more change to the branch. -6. **Add the output of your git commit log** for your feature branch to your lab report ```git log --oneline```. +1. Create the branch ```git checkout -b labreport```. +2. Create a lab report markdown file (ex. ```cp labreports/LAB_Template.md labreports/LAB_[GITHUB USERNAME].md``` ). +3. Add your lab report ```git add *``` +4. Add the file to your branch ```git commit -a -m "your commit and reference @trevordbunch in the message"```. +5. Push the change to GitHub ```git push -u origin labreport```. +6. As you make additional changes to the lab report, commit and push at least one more change to the branch. +7. **Add the output of your git commit log** for your feature branch to your lab report ```git log --oneline```. +8. **Generate a simple diagram** that demonstrates the relationship between your main and feature branch in your forked repository. -# Step 4: Setup a Continuous Integration configuration -1. [Signup for CircleCI](https://circleci.com/signup/) with your GitHub account. -2. Login to CircleCI and add your project to your account (ex. https://circleci.com/add-projects/gh/[YOUR GITHUB HANDLE]) by clicking _Add Project_. +## Step 5: Setup a Continuous Integration configuration +1. [Sign up for CircleCI](https://circleci.com/signup/) with your GitHub account. +2. Login to CircleCI and add your project to your account (ex. https://circleci.com/add-projects/gh/[YOUR_GITHUB_HANDLE]) by clicking _Add Project_. 3. Follow the setup instructions, including creating the .circleci directory and adding the default config.yml file. -![CircleCI setup](../assets/circleci_setup.png "CircleCI Setup") +![CircleCI setup](assets/circleci_setup.png "CircleCI Setup") - Create a directory name .circleci in your project ```mkdir .circleci```. - Add a file to that directory named config.yml ```code .circleci/config.yml```. - Copy the content for the setup instructions into config.yml. -4. **Document in your lab report** what your .circleci/config.yml is doing in as much detail as you can determine. A diagram is not required but is highlt encouraged. **Additionally, answer the following questions.** +4. **Document in your lab report** what your .circleci/config.yml is doing in as much detail as you can determine. A diagram is not required but is highly encouraged. **Additionally, answer the following questions.** - What do the various sections on the config file do? - When a CI build is successful, what does that philosophically and practically/precisely indicate about the build? - If you were to take the next step and ready this project for Continuous Delivery, what additional changes might you make in this configuration (conceptual, not code)? -# Step 5: Merging the feature branch +## Step 6: Merging the feature branch 1. Commit your changes to your feature branch ```git commit -a -m "your commit message```. -2. Switch to the master branch ```git checkout master```. +2. Switch to the main branch ```git checkout main```. 3. Merge the changes from your feature branch ```git merge labreport```. -4. **Add the output of your git commit log** from master to your lab report ```git log --oneline```. +4. **Add the output of your git commit log** from main to your lab report ```git log --oneline```. 5. Validate that your CircleCI build is running doing so successfully, **by grabbing a screenshot of the _Jobs_ list in CircleCI and including it in your report**. -# Step 6: Submitting a Pull Request -Once you've completed your report markdown, have ensured that your forked repository is successfully running in CircleCI, and have committed all your changes to your (primary) master branch, initiate a Pull Request in GitHub to submit your Lab Report. -1. Navigate to the root of your forked repository (ex. https://github.com/YOURHANDLE/cis411_lab0). +## Step 7: Submitting a Pull Request +Once you've completed your report markdown, have ensured that your forked repository is successfully running in CircleCI, and have committed all your changes to your (primary) main branch, and `push` your updated main branch back to Github, and then initiate a Pull Request in GitHub to submit your Lab Report. +1. Navigate to the root of your forked repository (ex. https://github.com/YOURHANDLE/cis411_lab1_CI). 2. Click the _New pull request_ button. -3. Choose the base fork _tangollama/cis411_lab0_ is the target and that your fully updated _master_ branch is the source. +3. Choose the base fork _trevordbunch/cis411_lab1_ is the target and that your fully updated _main_ branch is the source. 4. Enter a title and description for the Pull Request (PR), **referencing at least one other student in the content via their GitHub handle**, and submit the PR. -# Step 7: [EXTRA CREDIT] Augment the core project +# Step 8: [EXTRA CREDIT] Augment the core project For the purposes of gaining 10%, 20% _or even more extra credit_ on the assignment, perform any of the following: 1. Add one or more unit tests to the core assignment project. 2. Configure the CircleCI config.yml to automatically build a Docker image of the project. 3. Configure an automatic deployment of the successful CircleCI build to an Amazon EC2 instance. -**Note this work in your lab report** by submitting it in your PR and linking to either the PR or the specific commit as recorded in GitHub in your lab report. \ No newline at end of file +**Note this work in your lab report** by submitting it in your PR and linking to either the PR or the specific commit as recorded in GitHub in your lab report. diff --git a/README.md b/README.md new file mode 100644 index 00000000..3abafdbb --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# CIS 411 Lab 1: Continuous Integration +This is the Continuous Integration for CIS 411: Systems Analysis and Design for [Messiah University](http://messiah.edu) + +This lab has four purposes: +1. Within Systems Analysis and Design, you are going to need to articulate a DEVOPs process that includes **Continuous Integration (CI)**, practice of merging all developers' working copies to a shared mainline several times a day,[^1] and be able to describe what is conceptually happening behind the scenes. +2. Develop a comfort using CI tools, such as CircleCI. +3. Read installation requirements to get a system running locally, so that you learn how to contribute and test locally. +4. To ensure that you are only accepting code that works within your repository, you will apply knowledge of spinning up a local environment into CI test condition. + +# Doing the Lab +## 1. Pre-Requisites +1. GitHub account +2. Git is installed on your development machine. +3. Text editor or other integrated development environment (IDE) for modifying code. +4. Install [node.js](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/cli/install) (STEP 3 in the Lab Instructions). +5. CircleCI account (STEP 5 in the Lab Instructions) + +## 2. Lab Description +Within this lab, you will need to fork a repository that has a simple node / graphql application. After confirming that you can successfully run and perform simple actions within the application, then you will configuration CircleCI to perform a test that the application did not break with any changes in the commit before allowing the code into the repository. + +Detailed instructions are [here](LAB_INSTRUCTIONS.md), and you are expected to compile your findings into a labreport following this [template](labreports/LAB_Template.md). + +## 3. Submissions +You are expected to create a lab report as a markdown file under the labreports directory using the **LAB_[GITHUB Handle].md** naming convention in your forked repository. After you have reviewed your work, then you should submit a `Pull Request` to this repository with your lab report and any accompanying images/files (e.g., required diagrams). Add the `Pull Request` URL into the courseroom LMS (Canvas) for grading. + +# Resources +Lab Specific Help. +- [Detailed instructions](LAB_INSTRUCTIONS.md) +- [Lab template](labreports/LAB_Template.md) + +Node +- Node Download [https://nodejs.org/en/download/](https://nodejs.org/en/download/) +- Node Package Manager [https://docs.npmjs.com/cli/install](https://docs.npmjs.com/cli/install) +- Checking Node Versions [https://docs.npmjs.com/downloading-and-installing-node-js-and-npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) + +Footnotes +[^1]: Fowler, M. *Continuous Integration.* Retrieved from https://martinfowler.com/articles/continuousIntegration.html + +CircleCi +- [CircleCI Documentation](https://circleci.com/docs/) +- [Writing YAML](https://circleci.com/docs/2.0/writing-yaml/) +# License +This content is provided under the `MIT` [license](LICENSE). + +# Credits +Special thanks to Joel Worrall, aka [tangollama](https://github.com/tangollama), for co-developing this course and writing the original version of this lab [https://github.com/tangollama/cis411_lab0](https://github.com/tangollama/cis411_lab0). \ No newline at end of file diff --git a/assets/circleci_success.png b/assets/circleci_success.png new file mode 100644 index 00000000..c2e6ccba Binary files /dev/null and b/assets/circleci_success.png differ diff --git a/labreports/LAB.md b/labreports/LAB.md deleted file mode 100644 index 87c9a5f8..00000000 --- a/labreports/LAB.md +++ /dev/null @@ -1,57 +0,0 @@ -# Lab Report Template for CIS4011_Lab0 -Course: Messiah College CIS 411, Fall 2018 -Instructors: [Joel Worrall](https://github.com/tangollama) & [Trevor Bunch](https://github.com/trevordbunch) -Name: YOUR NAME -GitHub: [YOUR_HANDLE](https://github.com/YOUR_HANDLE) - -# Step 1: Fork this repository -- The URL of my forked repository -- The accompanying diagram of what my fork precisely and conceptually represents - -# Step 2: Clone your forked repository from the command line -- My GraphQL response from adding myself as an account on the test project -``` -{ - "data": { - "mutateAccount": { - "id": "a10db030-ded8-4397-a78f-30b79d3497ab", - "name": "MY NAME", - "email": "MY EMAIL" - } - } -} -``` - -# Step 3: Creating a feature branch -- The output of my git commit log -``` -d2ddea5 (HEAD -> master, origin/master, origin/HEAD) Version 0.0.1 of the lab instructions -ab312fc more progress -62fb0a5 more progress -fe1937b more in the lab instructions -3e807fb first section -9ae6b83 remove LAB.md -e429c1a lab instructions -968099e remove test db -7362cd1 working -44ce6ae Initial commit -``` - -# Step 4: Setup a Continuous Integration configuration -- What is the .circleci/config.yml doing? -- What do the various sections on the config file do? -- When a CI build is successful, what does that philosophically and practically/precisely indicate about the build? -- If you were to take the next step and ready this project for Continuous Delivery, what additional changes might you make in this configuration (conceptual, not code)? - -# Step 5: Merging the feature branch -* The output of my git commit log -* A screenshot of the _Jobs_ list in CircleCI - -# Step 6: Submitting a Pull Request -_Remember to reference at least one other student in the PR content via their GitHub handle._ - -# Step 7: [EXTRA CREDIT] Augment the core project -PR reference in the report to one of the following: -1. Add one or more unit tests to the core assignment project. -2. Configure the CircleCI config.yml to automatically build a Docker image of the project. -3. Configure an automatic deployment of the successful CircleCI build to an Amazon EC2 instance. \ No newline at end of file diff --git a/labreports/LAB_Template.md b/labreports/LAB_Template.md new file mode 100644 index 00000000..60cbac46 --- /dev/null +++ b/labreports/LAB_Template.md @@ -0,0 +1,79 @@ +# Lab Report: Continuous Integration +___ +**Course:** CIS 411, Spring 2021 +**Instructor(s):** [Trevor Bunch](https://github.com/trevordbunch) +**Name:** Your Name +**GitHub Handle:** Your GitHub Handle +**Repository:** Your Forked Repository +___ + +# Step 1: Fork this repository +- The URL of my forked repository: ENTER URL HERE +- The accompanying diagram of what my fork precisely and conceptually represents... + +# Step 2: Clone your forked repository from the command line +- My local file directory is... +- The command to navigate to the directory when I open up the command line is... + +# Step 3: Run the application locally +- My GraphQL response from adding myself as an account on the test project +``` json +{ + "data": { + "mutateAccount": { + "id": "5c345bb5-0c54-44ae-8e57-f5f00b0eddbb", + "name": "TREVOR BUNCH", + "email": "tbunch@messiah.edu" + } + } +} +``` + +# Step 4: Creating a feature branch +- The output of my git commit log +``` +Insert the logs here. +``` +- The accompanying diagram of what my feature branch precisely and conceptually represents... + +# Step 5: Setup a Continuous Integration configuration +- What is the .circleci/config.yml doing? + + +- What do the various sections on the config file do? + + +- When a CI build is successful, what does that philosophically and practically/precisely indicate about the build? + + +- If you were to take the next step and ready this project for Continuous Delivery, what additional changes might you make in this configuration (conceptual, not code)? + + +# Step 6: Merging the feature branch +* The output of my git commit log +``` +Trevors-MBP:cis411_lab0 trevorbunch$ git log --oneline +dbf826a (HEAD -> labreport, origin/labreport) Answer Step 4 +a9c1de6 Complete Step 1, 2 and 3 of LAB_TREVORDBUNCH +1ead543 remove LAB.md +8c38613 Initial commit of labreport with @tangollama +dabceca (upstream/main, origin/main, origin/HEAD, main) Merge pull request #24 from tangollama/circleci +a4096db Create README.md +... +44ce6ae Initial commit +(END) +``` + +* A screenshot of the _Jobs_ list in CircleCI +![CircleCI Success](../assets/circleci_success.png) + +# Step 7: Submitting a Pull Request +_Remember to reference at least one other student in the PR content via their GitHub handle._ + + + +# Step 8: [EXTRA CREDIT] Augment the core project +PR reference in the report to one of the following: +1. Add one or more unit tests to the core assignment project. +2. Configure the CircleCI config.yml to automatically build a Docker image of the project. +3. Configure an automatic deployment of the successful CircleCI build to an Amazon EC2 instance. diff --git a/package-lock.json b/package-lock.json index 95910295..f6da85af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "cis411_lab0", + "name": "cis411_lab1_CI", "version": "0.0.1", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index f0276e50..6508e88b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cis411_lab0", + "name": "cis411_lab1_CI", "version": "0.0.1", "description": "GitHub and CircleCI building a simple GraphQL service", "main": "server.js", @@ -9,7 +9,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/tangollama/cis411_lab0.git" + "url": "git+https://github.com/trevordbunch/cis411_lab1_CI.git" }, "keywords": [ "git", @@ -20,9 +20,9 @@ "author": "Joel Worrall ", "license": "MIT", "bugs": { - "url": "https://github.com/tangollama/cis411_lab0/issues" + "url": "https://github.com/trevordbunch/cis411_lab1_CI/issues" }, - "homepage": "https://github.com/tangollama/cis411_lab0#readme", + "homepage": "https://github.com/trevordbunch/cis411_lab1_CI#readme", "dependencies": { "express": "^4.16.3", "express-graphql": "^0.6.12",