Skip to content

Merge pull request #8 from cicsdev/dependabot/npm_and_yarn/multi-a027… #7

Merge pull request #8 from cicsdev/dependabot/npm_and_yarn/multi-a027…

Merge pull request #8 from cicsdev/dependabot/npm_and_yarn/multi-a027… #7

name: Continuous Integration
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: write
pull-requests: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
Bot-pyLint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "ansible-sdv-pipeline"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint flake8 ansible==10.2.0
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py') --fail-under 5 --fail-on F,E,W,C,R
- name: Checking code styling
run: |
flake8 .
#
Bot-ansible-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "ansible-sdv-pipeline"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install Ansible-lint
run: |
python -m pip install --upgrade pip
pip install ansible-lint
- name: Running Ansible-lint
run: ansible-lint ./*
#
Bot-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Installing dependencies
run: npm ci
- name: Linting the commit message
run: npx commitlint -V --from=HEAD~1
- name: Linting the application code
run: npm run lint-bot
- name: Running unit tests
run: npm run unit-test
Docs-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "docs"
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Installing dependencies
run: npm ci
- name: Linting the docs code
run: npm run lint
working-directory: "docs"
- name: Setup Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next
- name: Building docs
run: npm run build
- name: Uploading artifacts
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/out
#
Docs-deploy:
if: ${{ github.ref == 'refs/heads/main' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: "docs"
needs: Docs-build
steps:
- name: Publish to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
#
Dependabot-merge:
needs: [Bot-pyLint, Bot-ansible-lint, Bot-test, Docs-build]
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'cicsdev/cics-security-sdv-samples'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}