Lab: Runner - MacOS Latest
Introduction
In this lab, you will create and execute a GitHub Actions workflow that runs on the macos-latest
GitHub-hosted runner. This lab demonstrates how to display macOS operating system information and print a custom message.
Estimated Duration: 15–20 minutes
Instructions
Step 1: Set up your repository
-
Navigate to your GitHub repository where you want to create the workflow.
- If you don’t have a repository yet, create a new one by clicking + > New repository.
Step 2: Create the workflow file
-
In your repository, click the Code tab (if not already there).
-
Navigate to the
.github
folder. If it doesn’t exist:- Click Add file > Create new file
- Name the new file:
.github/workflows/runner-macos-latest.yml
-
Paste the following YAML content into the file:
name: Runner - MacOS Latest on: workflow_dispatch jobs: run: runs-on: macos-latest steps: - run: echo "This is a message from MacOS latest runner" - name: Display OS Information run: | system_profiler SPSoftwareDataType
-
Click Commit new file to save the workflow.
Step 3: Understand the workflow
- Workflow name:
Runner - MacOS Latest
- Trigger:
workflow_dispatch
– the workflow must be manually triggered. - Runner: Uses GitHub-hosted
macos-latest
virtual environment. -
Steps:
- The first step prints a custom message.
- The second step runs
system_profiler SPSoftwareDataType
to display macOS version and system details.
Step 4: Trigger the workflow manually
- Go to the Actions tab in your repository.
- Click on Runner - MacOS Latest from the workflow list.
- Click the Run workflow button and confirm the action.
Step 5: View the output
- Once the workflow is running, click on the latest run listed.
- Click on the run job to view details.
-
Expand the logs to see:
- The custom echo message.
- System details such as macOS version, build, and kernel version from
system_profiler
.
Summary
In this lab, you created and executed a GitHub Actions workflow using the macos-latest
runner. You used this environment to print system information, helping you understand what operating system is used when running jobs on GitHub’s macOS runners.