Skip to content

Commit d2aa3a6

Browse files
authored
CI fixups (#508)
- Permissions fixup - Slight modification to `licenseheaders` rule for more file types. See Also: johann-petrak/licenseheaders#78
1 parent 23d17e3 commit d2aa3a6

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/devcontainer.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,17 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v4
2929

30-
- name: Set NO_CACHE variable for nightly builds
31-
if: github.event_name == 'schedule'
30+
- name: Get commit messages
31+
id: get-commit-messages
32+
run: |
33+
# Only look at the last 10 commits, to avoid getting too much data.
34+
# If the message wasn't in there (e.g. because the push was a merge and too large), then we just ignore it.
35+
git fetch --deepen=10
36+
git log --format="%B" -10 ${{ github.event.before }}..${{ github.event.after }} > /tmp/commit_messages.txt || true
37+
echo "COMMIT_MESSAGES=$(cat /tmp/commit_messages.txt)" >> $GITHUB_OUTPUT
38+
39+
- name: Set NO_CACHE variable based on commit messages and for nightly builds
40+
if: github.event_name == 'schedule' || contains(steps.get-commit-messages.outputs.COMMIT_MESSAGES, 'NO_CACHE=true')
3241
run: |
3342
echo "NO_CACHE=true" >> $GITHUB_ENV
3443
@@ -37,6 +46,11 @@ jobs:
3746
set -x
3847
printenv
3948
echo "NO_CACHE: ${NO_CACHE:-}"
49+
echo "COMMIT_MESSAGES: ${{ steps.get-commit-messages.outputs.COMMIT_MESSAGES }}"
50+
echo "COMMIT_SHA: ${{ github.sha }}"
51+
echo "git log -1 ${{ github.sha }}: $(git log -1 ${{ github.sha }})"
52+
# Output the full event json for debugging.
53+
# cat ${{ github.event_path }}
4054
4155
- name: Build the devcontainer image
4256
timeout-minutes: 15
@@ -65,6 +79,7 @@ jobs:
6579
docker exec --user root mlos-devcontainer chown -R vscode:vscode /home/vscode
6680
docker exec --user root mlos-devcontainer mkdir -p /opt/conda/pkgs/cache /var/cache/pip
6781
docker exec --user root mlos-devcontainer chown -R vscode /opt/conda/pkgs/cache /var/cache/pip
82+
docker exec --user root mlos-devcontainer chown -R vscode /opt/conda/envs/mlos
6883
6984
- name: Update the conda env in the devcontainer
7085
timeout-minutes: 10

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ ENV_YML := conda-envs/${CONDA_ENV_NAME}.yml
99
PYTHON_FILES := $(shell find ./ -type f -name '*.py' 2>/dev/null | egrep -v -e '^./((mlos_core|mlos_bench)/)?build/' -e '^./doc/source/')
1010
MLOS_CORE_PYTHON_FILES := $(shell find ./mlos_core/ -type f -name '*.py' 2>/dev/null | egrep -v -e '^./mlos_core/build/')
1111
MLOS_BENCH_PYTHON_FILES := $(shell find ./mlos_bench/ -type f -name '*.py' 2>/dev/null | egrep -v -e '^./mlos_bench/build/')
12+
SCRIPT_FILES := $(shell find ./ -name '*.sh' -or -name '*.ps1' -or -name '*.cmd')
13+
SQL_FILES := $(shell find ./ -name '*.sql')
1214

1315
DOCKER := $(shell which docker)
1416
# Make sure the build directory exists.
@@ -70,9 +72,9 @@ build/pydocstyle.%.${CONDA_ENV_NAME}.build-stamp: build/conda-env.${CONDA_ENV_NA
7072
.PHONY: licenseheaders
7173
licenseheaders: build/licenseheaders.${CONDA_ENV_NAME}.build-stamp
7274

73-
build/licenseheaders.${CONDA_ENV_NAME}.build-stamp: $(PYTHON_FILES) doc/mit-license.tmpl
75+
build/licenseheaders.${CONDA_ENV_NAME}.build-stamp: $(PYTHON_FILES) $(SCRIPT_FILES) $(SQL_FILES) doc/mit-license.tmpl
7476
# Note: to avoid makefile dependency loops, we don't touch the setup.py files as that would force the conda-env to be rebuilt.
75-
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
77+
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
7678
touch $@
7779

7880
.PHONY: cspell

0 commit comments

Comments
 (0)