Fix docker compose puma command line #383
This file contains hidden or 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
| on: | |
| push: | |
| branches: [master, dev] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| branches: [master, dev] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| NB_SERVICES: ${{ secrets.NB_SERVICES }} | |
| PROJECT: optimizer | |
| jobs: | |
| rubocop: | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "APP_ENV=rubocop" | |
| BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.2 | |
| bundler-cache: true | |
| - name: Run RuboCop Error | |
| run: bundle exec rubocop --parallel -f c --config .rubocop.yml --fail-level E --display-only-fail-level-offenses | |
| - name: Run RuboCop Warning | |
| run: bundle exec rubocop --parallel -f c --config .rubocop.yml --fail-level W --display-only-fail-level-offenses | |
| - name: Run Lint, Security, Bundler and Gemspec cops | |
| run: bundle exec rubocop --parallel -f c --config .rubocop.yml --only Lint,Security,Bundler,Gemspec | |
| - name: Run Performance cops | |
| run: bundle exec rubocop --parallel -f c --config .rubocop.yml --only Performance | |
| - name: Run Layout cops | |
| # Run `bundle exec rubocop --fix-layout` to fix layout issues | |
| run: bundle exec rubocop --parallel -f c --config .rubocop.yml --only Layout | |
| # Activate auto-formatting instead of disabling this check | |
| # On vscode set the following two options and install ruby-rubocop extention to automate the layout formatting: | |
| # "editor.formatOnSave": true, "editor.formatOnSaveMode": "modificationsIfAvailable" | |
| # On sublimetext install Sublime RuboCop package and active auto formatting on file save | |
| - name: Run Style cops | |
| # run `bundle exec rubocop --auto-correct --only Style` to fix style issues | |
| run: bundle exec rubocop --parallel -f c --config .rubocop.yml --only Style | |
| build: | |
| if: github.event.pull_request.draft == false | |
| needs: rubocop | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download test fixtures | |
| run: | | |
| git clone https://gist.github.com/96dcb33063ccddd25e3bb2fd87c38f42.git /tmp/gist | |
| rm -f /tmp/gist/README.md | |
| mv /tmp/gist/* test/fixtures | |
| rm -rf /tmp/gist | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build | |
| uses: docker/build-push-action@v2 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| build-args: | | |
| BUNDLE_WITHOUT=production | |
| OPTIMIZER_ORTOOLS_VERSION=${{ secrets.OPTIMIZER_ORTOOLS_VERSION }} | |
| VROOM_VERSION=${{ secrets.VROOM_VERSION }} | |
| tags: optimizer-api:latest | |
| outputs: type=docker,dest=/tmp/optimizer-api.tar | |
| cache-from: type=local,src=/tmp/.buildx-cache | |
| cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | |
| - name: Move buildx cache | |
| run: | | |
| rm -rf /tmp/.buildx-cache | |
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
| - name: Upload Docker image artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: /tmp/optimizer-api.tar | |
| test_basis: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "COV=false LOG_LEVEL=info SKIP_DICHO=true SKIP_REAL_CASES=true SKIP_PERIODIC=true SKIP_SPLIT_CLUSTERING=true" | |
| TIMEOUT: 10m | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download Docker image | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: /tmp | |
| - name: Load Docker image | |
| run: docker load --input /tmp/optimizer-api.tar | |
| - name: Launch Stack | |
| run: timeout 4m docker compose -f ./docker/docker-compose.test.yml up --wait | |
| - name: Starting tests | |
| run: timeout ${TIMEOUT} docker compose -f ./docker/docker-compose.test.yml exec api rake test TESTOPTS="${TESTOPTS}" ${OPTIONS} | |
| test_dicho: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/heuristics/dichotomous_test.rb" | |
| TIMEOUT: 20m | |
| steps: &test_steps | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download Docker image | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: /tmp | |
| - name: Load Docker image | |
| run: docker load --input /tmp/optimizer-api.tar | |
| - name: Launch Stack | |
| run: timeout 4m docker compose -f ./docker/docker-compose.simple.test.yml up --wait | |
| - name: Starting tests | |
| run: timeout ${TIMEOUT} docker compose -f ./docker/docker-compose.simple.test.yml exec api rake test TESTOPTS="${TESTOPTS}" ${OPTIONS} | |
| test_real: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_test.rb" | |
| TIMEOUT: 10m | |
| steps: *test_steps | |
| test_real_periodic: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_periodic_test.rb" | |
| TIMEOUT: 10m | |
| steps: *test_steps | |
| test_real_periodic_solver: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_periodic_solver_test.rb" | |
| TIMEOUT: 25m | |
| steps: *test_steps | |
| test_periodic: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/heuristics/periodic_*" | |
| TIMEOUT: 3m | |
| steps: *test_steps | |
| test_split_clustering: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/interpreters/split_clustering_test.rb" | |
| TIMEOUT: 25m | |
| steps: *test_steps | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: [build, test_basis, test_dicho, test_real, test_real_periodic, test_real_periodic] | |
| if: github.ref == 'refs/heads/dev' || startsWith(github.event.ref, 'refs/tags/v') | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Docker Build and Push | |
| uses: cartoway/docker-compose-build-push-action@main | |
| with: | |
| registry_password: ${{ secrets.GITHUB_TOKEN }} | |
| service: api |