Skip to content

add job id in input dump file name #87

add job id in input dump file name

add job id in input dump file name #87

Workflow file for this run

# TODO use anchor when supported https://github.community/t/support-for-yaml-anchors/16128/81
name: Docker Image CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
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@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.7
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@v2
- name: Cache layers and gems
id: cache
uses: actions/cache@v2
with:
path: |
vendor/bundle
/tmp/.buildx-cache
key: ${{ runner.os }}-${{ hashFiles('Gemfile.lock') }}
- name: Check cached gems
run: |
echo $(pwd)
echo $(ls -lh vendor/bundle)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile
build-args: |
BUNDLE_WITHOUT=production
OPTIMIZER_ORTOOLS_VERSION=${{ secrets.OPTIMIZER_ORTOOLS_VERSION }}
VROOM_VERSION=${{ secrets.VROOM_VERSION }}
tags: registry.test.com/mapotempo-ce/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: Extract gems from image to cache folder
run: |
rm -rf vendor/bundle
mkdir -p vendor/bundle
docker load --input /tmp/optimizer-api.tar
docker cp "$(docker create --rm registry.test.com/mapotempo-ce/optimizer-api:latest)":/srv/app/vendor/bundle/. vendor/bundle
echo $(ls -lh vendor/bundle)
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
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"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/artifact/optimizer-api.tar
- name: Launch Stack
timeout-minutes: 4
run: ./.github/actions/launch_stack.sh
shell: bash
- name: Starting tests
timeout-minutes: 10
run: ./.github/actions/tests.sh
shell: bash
test_dicho:
needs: build
runs-on: ubuntu-latest
env:
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/heuristics/dichotomous_test.rb"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/artifact/optimizer-api.tar
- name: Launch Stack
timeout-minutes: 4
run: ./.github/actions/launch_stack.sh
shell: bash
- name: Starting tests
timeout-minutes: 20
run: ./.github/actions/tests.sh
shell: bash
test_real:
needs: build
runs-on: ubuntu-latest
env:
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_test.rb"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/artifact/optimizer-api.tar
- name: Launch Stack
timeout-minutes: 4
run: ./.github/actions/launch_stack.sh
shell: bash
- name: Starting tests
timeout-minutes: 10
run: ./.github/actions/tests.sh
shell: bash
test_real_periodic:
needs: build
runs-on: ubuntu-latest
env:
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_periodic_test.rb"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/artifact/optimizer-api.tar
- name: Launch Stack
timeout-minutes: 4
run: ./.github/actions/launch_stack.sh
shell: bash
- name: Starting tests
timeout-minutes: 10
run: ./.github/actions/tests.sh
shell: bash
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"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/artifact/optimizer-api.tar
- name: Launch Stack
timeout-minutes: 4
run: ./.github/actions/launch_stack.sh
shell: bash
- name: Starting tests
timeout-minutes: 25
run: ./.github/actions/tests.sh
shell: bash
test_periodic:
needs: build
runs-on: ubuntu-latest
env:
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/heuristics/periodic_*"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/artifact/optimizer-api.tar
- name: Launch Stack
timeout-minutes: 4
run: ./.github/actions/launch_stack.sh
shell: bash
- name: Starting tests
timeout-minutes: 3
run: ./.github/actions/tests.sh
shell: bash
test_split_clustering:
needs: build
runs-on: ubuntu-latest
env:
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/interpreters/split_clustering_test.rb"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/artifact/optimizer-api.tar
- name: Launch Stack
timeout-minutes: 4
run: ./.github/actions/launch_stack.sh
shell: bash
- name: Starting tests
timeout-minutes: 25
run: ./.github/actions/tests.sh
shell: bash