diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b76a33..3f82524 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,53 +1,75 @@ -stages: - - lint - - test - - build - - deploy +name: CI/CD Pipeline -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache" +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] -cache: - paths: - - .pip-cache/ +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + - name: Lint with flake8 + run: flake8 . -lint: - stage: lint - image: python:3.9 - before_script: - - pip install flake8 - script: - - flake8 . - -test: - stage: test - image: python:3.9 - before_script: - - pip install -r requirements.txt - - pip install pytest pytest-cov - script: - - pytest tests/ --cov=./ --cov-report=xml - artifacts: - reports: - coverage_report: - coverage_format: cobertura + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest pytest-cov + - name: Run tests + run: pytest tests/ --cov=./ --cov-report=xml + - name: Upload coverage report + uses: actions/upload-artifact@v2 + with: + name: coverage-report path: coverage.xml -build: - stage: build - image: python:3.9 - script: - - pip install pyinstaller - - pyinstaller --onefile main.py - artifacts: - paths: - - dist/main + build: + runs-on: ubuntu-latest + needs: [lint, test] + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + - name: Build executable + run: pyinstaller --onefile main.py + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: abap-code-scanner + path: dist/main -deploy: - stage: deploy - image: python:3.9 - script: - - echo "Deploying application..." - # Add your deployment steps here - only: - - main # This job will only run on the main branch \ No newline at end of file + deploy: + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/main' + steps: + - name: Deploy application + run: | + echo "Deploying application..." + # Add your deployment steps here \ No newline at end of file