8000 GitHub - codebeltnet/docker-compose: An opinionated GitHub Action for defining and running multi-container applications with Docker as part of your CI flow.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

An opinionated GitHub Action for defining and running multi-container applications with Docker as part of your CI flow.

License

Notifications You must be signed in to change notification settings

codebeltnet/docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

.NET Build

Uses the Docker CLI docker compose command that define and run multi-container applications with Docker.

This action is part of the Codebelt umbrella and ensures a consistent way of:

  • Defining your CI/CD pipeline
  • Structuring your repository
  • Keeping your codebase small and feasible
  • Writing clean and maintainable code
  • Deploying your code to different environments
  • Automating as much as possible

A paved path to excel as a DevSecOp 8000 s Engineer.

Usage

To use this action in your GitHub repository, you can follow these steps:

uses: codebeltnet/docker-compose@v1

Inputs

with:
  # Path to one or more docker-compose files.
  # Supports globbing.
  composeFiles: '**/docker-compose.yml'
  # The command to run. 
  command:
  # Additional docker compose options.
  options: ''

Outputs

This action has no outputs.

Examples

Build for Release in src folder and upload build artifact

- name: Spin up SQL Server for integration test
  uses: codebeltnet/docker-compose@v1
  with:
    command: up
    options: -d
- name: Take down SQL Server
  uses: codebeltnet/docker-compose@v1
  with:
    command: down

Sample workflow for .NET Class Library

name: Generic CI/CD Pipeline (.NET Library)
on:
  push:
    branches: [main]
    paths-ignore:
      - .codecov
      - .docfx
      - .github
      - .nuget
  pull_request:
    branches: [main]
  workflow_dispatch:
    inputs:
      configuration:
        type: choice
        description: The build configuration to use in the deploy stage.
        required: true
        default: Release
        options:
          - Debug
          - Release

jobs:
  build:
    name: πŸ› οΈ Build
    runs-on: ubuntu-22.04
    outputs:
      version: ${{ steps.minver-calculate.outputs.version }}
    steps:
      - name: Checkout
        uses: codebeltnet/git-checkout@v1

      - name: Install .NET
        uses: codebeltnet/install-dotnet@v1

      - name: Install MinVer
        uses: codebeltnet/dotnet-tool-install-minver@v1

      - id: minver-calculate
        name: Calculate Version
        uses: codebeltnet/minver-calculate@v1

      - name: Download strongname.snk file
        uses: codebeltnet/gcp-download-file@v1
        with: 
          serviceAccountKey: ${{ secrets.GCP_TOKEN }}
          bucketName: ${{ secrets.GCP_BUCKETNAME }}
          objectName: strongname.snk

      - name: Restore Dependencies
        uses: codebeltnet/dotnet-restore@v1

      - name: Build for Preview
        uses: codebeltnet/dotnet-build@v1
        with:
          configuration: Debug

      - name: Build for Production
        uses: codebeltnet/dotnet-build@v1
        with:
          configuration: Release

  pack:
    name: πŸ“¦ Pack
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        configuration: [Debug, Release]
    needs: [build]
    steps:     
      - name: Pack for ${{ matrix.configuration }}
        uses: codebeltnet/dotnet-pack@v1
        with:
          configuration: ${{ matrix.configuration }}
          uploadPackedArtifact: true
          version: ${{ needs.build.outputs.version }}

  test:
    name: πŸ§ͺ Test
    needs: [build]
    strategy:
      matrix:
        os: [ubuntu-22.04, windows-2022]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: codebeltnet/git-checkout@v1

      - name: Install .NET
        uses: codebeltnet/install-dotnet@v1

      - name: Install .NET Tool - Report Generator
        uses: codebeltnet/dotnet-tool-install-reportgenerator@v1

      - name: Set environment variable for build switches
        run: |
          if [ "${{ runner.os }}" == "Linux" ]; then
            echo "BUILD_SWITCHES=-p:SkipSignAssembly=true" >> $GITHUB_ENV
          else
            echo "BUILD_SWITCHES=-p:SkipSignAssembly=true --filter FullyQualifiedName!~SqlClient" >> $GITHUB_ENV
          fi

      - name: Spin up SQL Server test dependency for Debug build
        uses: codebeltnet/docker-compose@v1
        with:
          command: up
          options: -d

      - name: Test with Debug build
        uses: codebeltnet/dotnet-test@v1
        with:
          configuration: Debug
          buildSwitches: ${{ env.BUILD_SWITCHES }}

      - name: Take down SQL Server test dependency for Debug build
        uses: codebeltnet/docker-compose@v1
        with:
          command: down

      - name: Spin up SQL Server test dependency for Release build
        uses: codebeltnet/docker-compose@v1
        with:
          command: up
          options: -d
        env:
          SA_PASSWORD: ${{ secrets.SA_PASSWORD }}
          

      - name: Test with Release build
        uses: codebeltnet/dotnet-test@v1
        with:
          configuration: Release
          buildSwitches: ${{ env.BUILD_SWITCHES }}

      - name: Take down SQL Server test dependency for Release build
        uses: codebeltnet/docker-compose@v1
        with:
          command: down

  sonarcloud:
    name: πŸ”¬ Code Quality Analysis
    needs: [build,test]
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: codebeltnet/git-checkout@v1

      - name: Install .NET
        uses: codebeltnet/install-dotnet@v1

      - name: Install .NET Tool - Sonar Scanner
        uses: codebeltnet/dotnet-tool-install-sonarscanner@v1

      - name: Restore Dependencies
        uses: codebeltnet/dotnet-restore@v1

      - name: Run SonarCloud Analysis
        uses: codebeltnet/sonarcloud-scan@v1
        with:
          token: ${{ secrets.SONAR_TOKEN }}
          organization: your-sonarcloud-organization
          projectKey: your-sonarcloud-project-key
          version: ${{ needs.build.outputs.version }}

      - name: Build
        uses: codebeltnet/dotnet-build@v1
        with:
          buildSwitches: -p:SkipSignAssembly=true
          uploadBuildArtifact: false

      - name: Finalize SonarCloud Analysis
        uses: codebeltnet/sonarcloud-scan-finalize@v1
        with:
          token: ${{ secrets.SONAR_TOKEN }}

  codecov:
    name: πŸ“Š Code Coverage Analysis
    needs: [build,test]
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: codebeltnet/git-checkout@v1

      - name: Run CodeCov Analysis
        uses: codebeltnet/codecov-scan@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          repository: your-github-repository
          
  codeql:
    name: πŸ›‘οΈ Security Analysis
    needs: [build,test]
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: codebeltnet/git-checkout@v1

      - name: Install .NET
        uses: codebeltnet/install-dotnet@v1

      - name: Restore Dependencies
        uses: codebeltnet/dotnet-restore@v1

      - name: Prepare CodeQL SAST Analysis
        uses: codebeltnet/codeql-scan@v1

      - name: Build
        uses: codebeltnet/dotnet-build@v1
        with:
          buildSwitches: -p:SkipSignAssembly=true
          uploadBuildArtifact: false

      - name: Finalize CodeQL SAST Analysis
        uses: codebeltnet/codeql-scan-finalize@v1

  deploy:
    name: πŸš€ Deploy v${{ needs.build.outputs.version }}
    runs-on: ubuntu-22.04
    needs: [build,pack,test,sonarcloud,codecov,codeql]
    environment: Production
    steps:
      - uses: codebeltnet/nuget-push@v1
        with:
          token: ${{ secrets.NUGET_TOKEN }}
          configuration: ${{ inputs.configuration == '' && 'Release' || inputs.configuration }}

Contributing to Docker Compose

Contributions are welcome! Feel free to submit issues, feature requests, or pull requests to help improve this action.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Other Actions

πŸ”– Analyze with Codecov
πŸ”– Analyze with CodeQL
πŸ”– Finalyze with CodeQL
πŸ”– Docker Compose
πŸ”– .NET Build
πŸ”– .NET Pack
πŸ”– .NET Restore
πŸ”– .NET Test
πŸ”– Install .NET SDK
πŸ”– Install .NET Tool - MinVer
πŸ”– Install .NET Tool - Report Generator
πŸ”– Install .NET Tool - Sonar Scanner
πŸ”– GCP Download File
πŸ”– Git Checkout
πŸ”– MinVer Calculate
πŸ”– NuGet Push
πŸ”– Shell Globbing
πŸ”– Analyze with SonarCloud
πŸ”– Finalyze with SonarCloud

About

An opinionated GitHub Action for defining and running multi-container applications with Docker as part of your CI flow.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0