diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 49306224d3..2d9daaea00 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -27,8 +27,17 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set NO_CACHE variable for nightly builds - if: github.event_name == 'schedule' + - name: Get commit messages + id: get-commit-messages + run: | + # Only look at the last 10 commits, to avoid getting too much data. + # If the message wasn't in there (e.g. because the push was a merge and too large), then we just ignore it. + git fetch --deepen=10 + git log --format="%B" -10 ${{ github.event.before }}..${{ github.event.after }} > /tmp/commit_messages.txt || true + echo "COMMIT_MESSAGES=$(cat /tmp/commit_messages.txt)" >> $GITHUB_OUTPUT + + - name: Set NO_CACHE variable based on commit messages and for nightly builds + if: github.event_name == 'schedule' || contains(steps.get-commit-messages.outputs.COMMIT_MESSAGES, 'NO_CACHE=true') run: | echo "NO_CACHE=true" >> $GITHUB_ENV @@ -37,6 +46,11 @@ jobs: set -x printenv echo "NO_CACHE: ${NO_CACHE:-}" + echo "COMMIT_MESSAGES: ${{ steps.get-commit-messages.outputs.COMMIT_MESSAGES }}" + echo "COMMIT_SHA: ${{ github.sha }}" + echo "git log -1 ${{ github.sha }}: $(git log -1 ${{ github.sha }})" + # Output the full event json for debugging. + # cat ${{ github.event_path }} - name: Build the devcontainer image timeout-minutes: 15 @@ -65,6 +79,7 @@ jobs: docker exec --user root mlos-devcontainer chown -R vscode:vscode /home/vscode docker exec --user root mlos-devcontainer mkdir -p /opt/conda/pkgs/cache /var/cache/pip docker exec --user root mlos-devcontainer chown -R vscode /opt/conda/pkgs/cache /var/cache/pip + docker exec --user root mlos-devcontainer chown -R vscode /opt/conda/envs/mlos - name: Update the conda env in the devcontainer timeout-minutes: 10 diff --git a/Makefile b/Makefile index 176dd41953..679a22b24b 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,8 @@ ENV_YML := conda-envs/${CONDA_ENV_NAME}.yml PYTHON_FILES := $(shell find ./ -type f -name '*.py' 2>/dev/null | egrep -v -e '^./((mlos_core|mlos_bench)/)?build/' -e '^./doc/source/') MLOS_CORE_PYTHON_FILES := $(shell find ./mlos_core/ -type f -name '*.py' 2>/dev/null | egrep -v -e '^./mlos_core/build/') MLOS_BENCH_PYTHON_FILES := $(shell find ./mlos_bench/ -type f -name '*.py' 2>/dev/null | egrep -v -e '^./mlos_bench/build/') +SCRIPT_FILES := $(shell find ./ -name '*.sh' -or -name '*.ps1' -or -name '*.cmd') +SQL_FILES := $(shell find ./ -name '*.sql') DOCKER := $(shell which docker) # Make sure the build directory exists. @@ -70,9 +72,9 @@ build/pydocstyle.%.${CONDA_ENV_NAME}.build-stamp: build/conda-env.${CONDA_ENV_NA .PHONY: licenseheaders licenseheaders: build/licenseheaders.${CONDA_ENV_NAME}.build-stamp -build/licenseheaders.${CONDA_ENV_NAME}.build-stamp: $(PYTHON_FILES) doc/mit-license.tmpl +build/licenseheaders.${CONDA_ENV_NAME}.build-stamp: $(PYTHON_FILES) $(SCRIPT_FILES) $(SQL_FILES) doc/mit-license.tmpl # Note: to avoid makefile dependency loops, we don't touch the setup.py files as that would force the conda-env to be rebuilt. - conda run -n ${CONDA_ENV_NAME} licenseheaders -t doc/mit-license.tmpl -E .py .sh .ps1 -x mlos_bench/setup.py mlos_core/setup.py + conda run -n ${CONDA_ENV_NAME} licenseheaders -t doc/mit-license.tmpl -E .py .sh .ps1 .sql .cmd -x mlos_bench/setup.py mlos_core/setup.py touch $@ .PHONY: cspell