Update hackercmd.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HackerCMD CI/CD | |
# Trigger the workflow on push to the main branch and pull requests targeting it | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: # Allows manual triggering | |
# Define the jobs that run for this workflow | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 # Updated to avoid the migration warning | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 # Checks out the code from the repository | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' # Set the Python version you are using | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt # Install dependencies from the requirements.txt file | |
continue-on-error: false # Ensure that the job fails if this step fails | |
- name: Run Tests | |
run: | | |
pytest --maxfail=1 --disable-warnings -q # Modify the test command as per your project setup | |
continue-on-error: false # Ensure that the job fails if this step fails | |
- name: Build Project | |
run: | | |
echo "Building HackerCMD..." # Replace with actual build steps if necessary | |
# For example: python setup.py install | |
continue-on-error: false # Ensure that the job fails if this step fails | |
- name: Deploy to Staging (optional) | |
run: | | |
echo "Deploying to staging server..." # Replace with actual deployment steps | |
if: github.ref == 'refs/heads/main' # Only deploy on the main branch | |
# Linting Job | |
lint: | |
runs-on: ubuntu-22.04 # Updated to avoid the migration warning | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Dependencies | |
run: pip install -r requirements.txt | |
- name: Run Linting | |
run: | | |
pip install flake8 | |
flake8 . # Runs linting for Python code | |
continue-on-error: false # Ensure that the job fails if this step fails |