30 Continuous Integration Preview
Create a tiny CI job that runs automatically after a push.
Introduction
In this lab, you will create a minimal Continuous Integration (CI) job and watch it run automatically after you push a commit.
This lab is designed as a preview. If you run out of time, stop at any point. We will cover CI in depth in the next session.
Prerequisites
You should have:
- the course lab repository cloned locally
- Git working on your machine
- a GitHub account and access to a repository you can push to
Repository setup
For this lab, you must work in your own copy of the repository on GitHub.
- Create a fork of the instructor repository under your GitHub account: https://github.com/codyzu/res507-2025-2026-work.
- Clone your fork locally.
- Push all changes to your fork, not to the instructor repository.
You need a GitHub account to complete this lab.
If you do not already have one, create it before continuing.
During this lab, you will create new files and directories yourself.
For example, the scripts/ directory does not exist initially and will be created as part of the exercises.
Create a CI preview branch
Create a new branch for this lab:
git switch -c feature/ci-previewConfirm your status:
git statusAdd a script that CI can run
Create a new script file:
mkdir -p scriptsCreate scripts/ci-preview.sh with the following content:
#!/usr/bin/env bashset -euo pipefail
echo "CI preview: hello from $(uname -s)"echo "Current directory:"pwd
echo "Repository status:"git status
echo "Done."Make the script executable:
chmod +x scripts/ci-preview.shRun it locally to confirm it works:
./scripts/ci-preview.shAdd a minimal CI configuration
Add a minimal GitHub Actions workflow that runs after every push.
GitHub Actions workflow
Create the workflow directory:
mkdir -p .github/workflowsCreate .github/workflows/ci.yml:
name: CI Preview
on: push:
jobs: preview: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4
- name: Run preview script run: ./scripts/ci-preview.shCommit and push
Stage your changes:
git add scripts .github/workflows/ci.ymlCommit:
git commit -m "Add CI preview job"Push your branch to your remote:
git push -u origin feature/ci-previewObserve the CI run
Open your repository on GitHub and go to the Actions tab.
You should see a workflow run named CI Preview for your branch.
Open the job logs and confirm you can find these lines:
CI preview: hello fromRepository status:Done.
Troubleshooting
CI cannot find the script
Confirm the script exists and is executable:
ls -la scriptsPermission denied when running the script
Re-apply executable permissions and commit the change:
chmod +x scripts/ci-preview.shgit add scripts/ci-preview.shgit commit -m "Make CI preview script executable"git pushNo CI run appears after pushing
Confirm you pushed to the correct remote and branch:
git remote -vgit branch --show-currentIf you are using GitHub Actions, confirm the workflow file exists:
ls -la .github/workflowsWrap-up
You have created a minimal CI job that runs automatically after a push.
In the next session, you will expand this into a real pipeline with checks like formatting, linting, and tests.