apuntes:cicd
−Table of Contents
Integración y despliegue continuo de una aplicación
Testing
Workflow: Node.js
name: Unit and integration tests on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-20.04 strategy: matrix: node-version: [18.x, 20.x, 22.x] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm install - run: docker compose -f docker-compose.dev.yaml up -d - run: sleep 3 - run: npm run unit-test - run: npm run integration-test
Crear una imagen docker
Workflow: Docker Image
name: Docker Image CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build the Docker image run: docker build . --file Dockerfile --tag cities:$(date +%s)
Publicar una imagen docker en Docker Hub
Workflow: Docker Image
Lanzar un análisis de código con Sonarqube
Workflow: SonarQube
name: Sonarqube on: push: branches: - main pull_request: types: [opened, synchronize, reopened] jobs: sonarqube: name: SonarQube runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: SonarQube Scan uses: SonarSource/sonarqube-scan-action@v5 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
© 2024 Santiago Faci
apuntes/cicd.txt · Last modified: 2025/03/25 00:33 by Santiago Faci