Skip to content

435 integrate meta #174

435 integrate meta

435 integrate meta #174

Workflow file for this run

# SPDX-FileCopyrightText: Alliander N. V.
#
# SPDX-License-Identifier: Apache-2.0
name: pr
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
select-components:
runs-on: ubuntu-24.04
outputs:
REBUILD_CORE: ${{ steps.variables.outputs.REBUILD_CORE }}
UBUNTU_COMPONENTS: ${{ steps.variables.outputs.UBUNTU_COMPONENTS }}
REBUILD_UBUNTU_IMAGES: ${{ steps.variables.outputs.REBUILD_UBUNTU_IMAGES }}
CUDA_COMPONENTS: ${{ steps.variables.outputs.CUDA_COMPONENTS }}
REBUILD_CUDA_IMAGES: ${{ steps.variables.outputs.REBUILD_CUDA_IMAGES }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"
- run: pip install pyyaml requests
- id: variables
run: python3 github.py --select-components changed
build-ubuntu:
needs: select-components
if: needs.select-components.outputs.REBUILD_CORE == 'true'
strategy:
matrix:
runner: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- name: Deploy image
uses: ./.github/actions/deploy-image
with:
component: base
tag: ${{ env.BRANCH_NAME }}
runner: ${{ matrix.runner }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
build-ubuntu-manifest:
needs: build-ubuntu
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Create manifest
uses: ./.github/actions/create-manifest
with:
components: '["base"]'
tag: ${{ env.BRANCH_NAME }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
build-ubuntu-images:
needs: [select-components, build-ubuntu-manifest]
if: always() && needs.select-components.outputs.REBUILD_UBUNTU_IMAGES == 'true'
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, ubuntu-24.04-arm]
component: ${{ fromJSON(needs.select-components.outputs.UBUNTU_COMPONENTS) }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- name: Deploy image
uses: ./.github/actions/deploy-image
with:
component: ${{ matrix.component }}
tag: ${{ env.BRANCH_NAME }}
runner: ${{ matrix.runner }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
build-ubuntu-images-manifest:
needs: [select-components, build-ubuntu-images]
if: always() && needs.select-components.outputs.REBUILD_UBUNTU_IMAGES == 'true'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Create manifest
uses: ./.github/actions/create-manifest
with:
components: ${{ needs.select-components.outputs.UBUNTU_COMPONENTS}}
tag: ${{ env.BRANCH_NAME }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
build-cuda:
needs: [select-components]
if: needs.select-components.outputs.REBUILD_CORE == 'true'
strategy:
matrix:
runner: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- name: Deploy image
uses: ./.github/actions/deploy-image
with:
component: cuda
tag: ${{ env.BRANCH_NAME }}
runner: ${{ matrix.runner }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
build-cuda-manifest:
needs: build-cuda
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Create manifest
uses: ./.github/actions/create-manifest
with:
components: '["cuda"]'
tag: ${{ env.BRANCH_NAME }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
build-cuda-images:
needs: [select-components, build-cuda-manifest]
if: always() && needs.select-components.outputs.REBUILD_CUDA_IMAGES == 'true'
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, ubuntu-24.04-arm]
component: ${{ fromJSON(needs.select-components.outputs.CUDA_COMPONENTS) }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- name: Deploy image
uses: ./.github/actions/deploy-image
with:
component: ${{ matrix.component }}
tag: ${{ env.BRANCH_NAME }}
runner: ${{ matrix.runner }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
build-cuda-images-manifest:
needs: [select-components, build-cuda-images]
if: always() && needs.select-components.outputs.REBUILD_CUDA_IMAGES == 'true'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Create manifest
uses: ./.github/actions/create-manifest
with:
components: ${{ needs.select-components.outputs.CUDA_COMPONENTS }}
tag: ${{ env.BRANCH_NAME }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
linting:
needs: [build-ubuntu-images-manifest, build-cuda-images-manifest]
if: always()
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Set up python3
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: pip install pyyaml mashumaro
- name: Run linting in alliander_tests container
run: python3 start.py --linting
test:
needs: [build-ubuntu-images-manifest, build-cuda-images-manifest]
if: always()
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ env.BRANCH_NAME }}
- name: Docker login
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up python3
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: pip install pyyaml mashumaro
- name: Run tests in alliander_tests container
run: python3 start.py --pytest-no-nvidia