Rucio replica sorting service using geolocation #1917
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: | |
- name: Checkout to repository | |
uses: actions/[email protected] | |
- name: Read file contents | |
working-directory: ./.github/workflows | |
id: set-matrix | |
run: | | |
echo "matrix<<EOF" >> $GITHUB_OUTPUT | |
cat deploy-config.json >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
test: | |
needs: build-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
python-version: ["3.10"] | |
app: "${{fromJson(needs.build-matrix.outputs.matrix)}}" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout to repository | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
if: ${{ matrix.app.test_required }} | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: 1.8.3 | |
- 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: | | |
PYTHONPATH=src poetry run python -m coverage run -m pytest -r sx | |
- name: Report coverage with Codecov | |
if: ${{ matrix.app.test_required }} | |
uses: codecov/codecov-action@v4 | |
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/[email protected] | |
- name: Extract tag name | |
working-directory: ${{ matrix.app.dir_name }} | |
shell: bash | |
run: echo "imagetag=sslhep/${{matrix.app.image_name}}:$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT | |
id: extract_tag_name | |
- name: Extract Cache Dir | |
working-directory: ${{ matrix.app.dir_name }} | |
shell: bash | |
run: echo "cachetag=sslhep/${{matrix.app.image_name}}:buildcache" >> $GITHUB_OUTPUT | |
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/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/[email protected] | |
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 | |
file: ${{ matrix.app.dockerfile }} | |
platforms: linux/amd64,linux/arm64 |