CI/CD Automation Scripts
In screenly/playground, CI/CD has been set up using GitHub Actions, which automates the building, testing, and deployment processes. Below are the details of the CI/CD automation, including the workflows and scripts available to support it.
GitHub Actions Workflows
The .github/workflows
directory contains multiple YAML files that define the CI/CD pipelines. Each workflow is responsible for deploying specific applications or assets. Below are some key examples of the workflows available:
Deploy Asset Metadata:
File:.github/workflows/deploy-asset-metadata.yml
name: Deploy Asset Metadata on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Deploy Asset Metadata run: echo "Deploying Asset Metadata"
Deploy Clock App:
File:.github/workflows/deploy-clock-app.yml
name: Deploy Clock App on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Deploy Clock App run: echo "Deploying Clock Application"
Deploy Countdown Timer:
File:.github/workflows/deploy-countdown-timer.yml
name: Deploy Countdown Timer on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Deploy Countdown Timer run: echo "Deploying Countdown Timer"
Linter Workflow:
File:.github/workflows/linter.yml
name: Linter on: push: branches: - main jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Run Linter run: echo "Running Linter"
Shell Scripts
In addition to the workflows defined in YAML, there are shell scripts that support some automation tasks. One example is the script for copying the playground theme:
Copy Playground Theme:
File:scripts/copy_playground_theme.sh
#!/bin/bash echo "Copying Playground Theme..." cp -R bootstrap/theme/* /path/to/deployment/directory
This script facilitates the deployment process by copying necessary files to the target directory, ensuring that the latest theme files are available.
Dockerfile for Dynamic Playlists
For deploying applications like Dynamic Playlists, a Dockerfile is used, enabling containerization. Below is an example of the Dockerfile included in the dynamic-playlists
directory:
FROM python:3-alpine
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
CMD python app.py
This Dockerfile sets up a Python environment, installs necessary dependencies, and runs the app.py
script, providing a consistent environment for the application to run.
Next Steps if CI/CD is Not Set Up
If the project has not yet set up CI/CD, it is advisable to:
Assess the Workflow Requirements: Identify which applications and assets require deployment automation.
Define Actions and Triggers: Create YAML files for GitHub Actions that outline the steps for each deployment process, considering triggers (such as
push
events).Implement Linting and Testing: Include linter checks and unit tests in workflows to maintain code quality.
Utilize Docker: For applications that require specific environments, Dockerfiles should be created to facilitate consistent deployment.
By following these steps, teams can establish a robust CI/CD pipeline that enhances deployment efficiency and code reliability.
Sources
- Directory Listing Analysis: Provided directory structure information up to October 2023.