Merge pull request #1777 from neurodesk/contribution-1776-fastsurfer #1076
This file contains hidden or 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: auto-build | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| packages: write | |
| id-token: write | |
| on: | |
| push: | |
| paths: | |
| - recipes/** | |
| branches: | |
| - main | |
| jobs: | |
| list-apps: | |
| runs-on: ubuntu-22.04 | |
| if: ${{ !contains(github.event.head_commit.message, 'skipci') }} | |
| outputs: | |
| app_list: ${{ steps.find_changed_recipes.outputs.app_list }} | |
| runner: ${{ steps.select_runner.outputs.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Find all recipe directories with changes | |
| id: find_changed_dirs | |
| uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 | |
| with: | |
| files: "recipes/**" | |
| dir_names: "true" | |
| json: "true" | |
| - name: Filter down to changed recipes | |
| id: find_changed_recipes | |
| if: steps.find_changed_dirs.outputs.any_changed == 'true' | |
| run: | | |
| # Get dir changelist -> convert list to json -> extract app name only -> remove duplicate apps | |
| changed_recipes=$(echo "${{ steps.find_changed_dirs.outputs.all_changed_files }}" | jq -rc '.[]' | cut -d/ -s -f 2-2 | jq -ncR '[inputs]' | jq -rc 'unique') | |
| echo "changed_recipes=${changed_recipes}" | |
| app_list='[' | |
| for APPLICATION in $(echo "${changed_recipes}" | jq -r '.[]'); do | |
| AUTOBUILD=$(cat .github/workflows/build-config.json | jq ".${APPLICATION} .autoBuild") | |
| [ "$AUTOBUILD" == "null" ] && AUTOBUILD=$(cat .github/workflows/build-config.json | jq ".default .autoBuild") | |
| if [ "$AUTOBUILD" = "true" ]; then | |
| app_list+="\"${APPLICATION}\"," | |
| else | |
| echo "$APPLICATION:autoBuild:$AUTOBUILD in build-config.json" | |
| fi | |
| done | |
| app_list=$(sed '$s/,$//' <<< $app_list) | |
| app_list+=']' | |
| echo "app_list=${app_list}" | |
| echo "app_list=${app_list}" >> $GITHUB_OUTPUT | |
| - name: Select runner | |
| id: select_runner | |
| run: | | |
| echo "runner=ubuntu-22.04" >> $GITHUB_OUTPUT | |
| # if [ "${{ github.repository }}" = "neurodesk/neurocontainers" ]; then | |
| # echo "runner=self-hosted" >> $GITHUB_OUTPUT | |
| # else | |
| # echo "runner=ubuntu-22.04" >> $GITHUB_OUTPUT | |
| # fi | |
| build-app: | |
| needs: list-apps | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| application: ${{ fromJSON(needs.list-apps.outputs.app_list) }} | |
| uses: ./.github/workflows/build-app.yml | |
| with: | |
| application: ${{ matrix.application }} | |
| runner: ${{ needs.list-apps.outputs.runner }} | |
| secrets: inherit |