diff --git a/.github/scripts/images-to-build.sh b/.github/scripts/images-to-build.sh index 3dbffe736..9a8855d96 100755 --- a/.github/scripts/images-to-build.sh +++ b/.github/scripts/images-to-build.sh @@ -28,8 +28,8 @@ fi # Check if athena folder was changed (then we need to build all module_* images) ATHENA_CHANGED=$(echo "$CHANGED_FILES" | grep -q "^athena" && echo "true" || echo "false") -# Loop over all root level directories -for DIR in */; do +# Loop over all root level directories and modules +for DIR in modules/*/*/ */; do # If a Dockerfile exists in the directory if [[ -e "${DIR}Dockerfile" ]]; then DIR=${DIR%/} # Remove trailing slash @@ -44,6 +44,7 @@ for DIR in */; do continue fi + # Build all images on develop branch if [[ "$GITHUB_REF" == "refs/heads/develop" ]]; then DIRS+=("$DIR") @@ -56,8 +57,11 @@ for DIR in */; do continue fi + # Extract just the final directory name (e.g., "module_example") from the full path + IMAGE_NAME_SUFFIX=$(basename "$DIR") + # Construct Docker image name and tag - IMAGE_NAME="athena/$DIR" + IMAGE_NAME="athena/$IMAGE_NAME_SUFFIX" IMAGE_TAG="pr-$PR_NUMBER" # Check if any file has changed in that directory since the pull request was created diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c67089bf4..a86ac0131 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,14 +67,17 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - + + - name: Set IMAGE_NAME + run: echo "IMAGE_NAME=$(basename ${{ matrix.image }})" >> $GITHUB_ENV + - name: Docker meta id: meta uses: docker/metadata-action@v4 with: images: | - ghcr.io/${{ github.repository_owner }}/Athena/${{ matrix.image }} - ls1tum/athena_${{ matrix.image }} + ghcr.io/${{ github.repository_owner }}/Athena/${{ env.IMAGE_NAME }} + ls1tum/athena_${{ env.IMAGE_NAME }} tags: | type=raw,value=${{ github.ref == 'refs/heads/develop' && 'develop' || github.sha }} type=raw,value=${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.sha }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a632302a5..1df16fc71 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,5 +33,6 @@ jobs: run: | echo "$HOME/.local/bin" >> $GITHUB_PATH poetry install + poetry run install_all - name: Run Prospector - run: poetry run prospector \ No newline at end of file + run: poetry run lint_all \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..457a7a928 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: Tests + +on: + push: + branches: + - develop + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + - name: Cache Poetry dependencies + uses: actions/cache@v2 + with: + path: ~/.cache/pypoetry + key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-poetry- + - name: Install dependencies + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + poetry install + poetry run install_all + - name: Run tests + run: poetry run test_all \ No newline at end of file diff --git a/.idea/runConfigurations/module_programming_llm.xml b/.idea/runConfigurations/module_programming_llm.xml index 5eadb10a0..ccf45c810 100644 --- a/.idea/runConfigurations/module_programming_llm.xml +++ b/.idea/runConfigurations/module_programming_llm.xml @@ -1,14 +1,16 @@ +