597 make sidecar and transformer containers communicate over socket #923
Workflow file for this run
This file contains 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
name: Test and Build Docker Images | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
workflow_call: | |
env: | |
DOCKERHUB_ORG: sslhep | |
jobs: | |
build-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Read file contents | |
working-directory: ./.github/workflows | |
id: set-matrix | |
run: | | |
content=`cat deploy-config.json` | |
# the following lines are only required for multi line json | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
# end of optional handling for multi line json | |
echo "::set-output name=matrix::$content" | |
- run: | | |
echo "${{ steps.set-matrix.outputs.matrix }}" | |
test: | |
needs: build-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
app: ${{fromJson(needs.build-matrix.outputs.matrix)}} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
if: ${{ matrix.app.test_required }} | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.2.2 | |
- name: Install dependencies | |
working-directory: ${{ matrix.app.dir_name }} | |
if: ${{ matrix.app.test_required }} | |
run: | | |
echo "${{ matrix.app }}" | |
poetry install --no-root --with=test | |
pip list | |
- name: Lint with Flake8 | |
working-directory: ${{ matrix.app.dir_name }} | |
if: ${{ matrix.app.test_required }} | |
run: | | |
poetry run flake8 | |
- name: Test with pytest | |
working-directory: ${{ matrix.app.dir_name }} | |
if: ${{ matrix.app.test_required }} | |
run: | | |
poetry run python -m coverage run -m pytest -r sx | |
- name: Report coverage with Codecov | |
if: ${{ matrix.app.test_required }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
publish: | |
needs: [build-matrix, test] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
app: ${{fromJson(needs.build-matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@master | |
- name: Extract tag name | |
working-directory: ${{ matrix.app.dir_name }} | |
shell: bash | |
run: echo "##[set-output name=imagetag;]$(echo sslhep/${{matrix.app.image_name}}:${GITHUB_REF##*/})" | |
id: extract_tag_name | |
- name: Extract Cache Dir | |
working-directory: ${{ matrix.app.dir_name }} | |
shell: bash | |
run: echo "##[set-output name=cachetag;]$(echo sslhep/${{matrix.app.image_name}}:buildcache)" | |
id: extract_cache_name | |
- name: Print Cache Tag Name | |
shell: bash | |
run: | | |
echo "${{ steps.extract_cache_name.outputs.cachetag }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ matrix.app.dir_name }} | |
push: true | |
tags: ${{ steps.extract_tag_name.outputs.imagetag }} | |
cache-from: type=${{ format('registry,ref={0}',steps.extract_cache_name.outputs.cachetag) }} | |
cache-to: type=${{ format('registry,ref={0}',steps.extract_cache_name.outputs.cachetag) }},mode=max | |
if: ${{ matrix.app.dockerfile }} | |
file: ${{ matrix.app.dockerfile }} | |