diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..15a61d6 --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,18 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.github/workflows/task2.yml b/.github/workflows/task2.yml new file mode 100644 index 0000000..fb6c3c4 --- /dev/null +++ b/.github/workflows/task2.yml @@ -0,0 +1,21 @@ +name: System Information Workflow + +on: + push: + workflow_dispatch: # This enables manual triggering from the GitHub Actions tab + +jobs: + gather-system-info: + runs-on: ubuntu-latest # Specifies the runner environment + + steps: + - name: Display Runner Information + run: | + echo "Gathering system information..." + echo "Operating System: $(uname -a)" + echo "CPU Info:" + lscpu + echo "Memory Info:" + free -h + echo "Disk Usage:" + df -h diff --git a/submission/1.png b/submission/1.png new file mode 100644 index 0000000..f911566 Binary files /dev/null and b/submission/1.png differ diff --git a/submission/2.png b/submission/2.png new file mode 100644 index 0000000..e6dfd80 Binary files /dev/null and b/submission/2.png differ diff --git a/submission/submission9.md b/submission/submission9.md new file mode 100644 index 0000000..d6d0dd0 --- /dev/null +++ b/submission/submission9.md @@ -0,0 +1,32 @@ +# Lab 9 + +## Task 1 + +1. Set Up a Basic GitHub Action from the [Quick Start Guide](https://docs.github.com/en/actions/quickstart) + - Create a [YAML file](../.github/workflows/github-actions-demo.yml). + - Copy the example YAML content from the guide into this file. + - Push the changes to a new branch. + - Review the workflow behavior. + +2. Observations: + - We’ve created an action, which appears under the name specified in `run-name`. + ![alt text](1.png) + - The example highlights the following features of GitHub Actions: + - You can define when to run the action using `on: []`. + - You can define `jobs:` to specify tasks GitHub will run. + - Within `jobs:`, the `runs-on:` setting defines the machine environment for the job. + - Each job includes a series of steps, which are commands executed in order. + +## Task 2 + +1. Set Up a Manual Trigger for the Action + - Add `workflow_dispatch` as a trigger in the YAML file: + ```yaml + on: [push, workflow_dispatch] + ``` + - Now, the action can also be started manually. + +2. Collect System Information + - Create a new job specifically for gathering system metrics. + - Result: + ![alt text](2.png)