Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 56 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2 # In PR, has extra merge commit: ^1 = PR, ^2 = base
# submodules: true # Fails on nimyaml tests

- name: Check copyright year (Linux)
if: github.event_name == 'pull_request' && runner.os == 'Linux'
run: |
excluded_files="config.yaml"
excluded_extensions="ans|json|md|png|ssz|txt"

current_year=$(date +"%Y")
outdated_files=()
while read -r file; do
if ! grep -qE 'Copyright \(c\) .*'$current_year' Status Research & Development GmbH' "$file"; then
outdated_files+=("$file")
fi
done < <(git diff --name-only --diff-filter=AM --ignore-submodules HEAD^ HEAD | grep -vE '(\.('$excluded_extensions')|'$excluded_files')$' || true)

if (( ${#outdated_files[@]} )); then
echo "The following files do not have an up-to-date copyright year:"
for file in "${outdated_files[@]}"; do
echo "- $file"
done
exit 2
fi

- name: MSYS2 (Windows amd64)
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
Expand Down Expand Up @@ -164,25 +139,6 @@ jobs:
${make_cmd} -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update
./env.sh nim --version

- name: Check submodules (Linux)
if: github.event_name == 'pull_request' && runner.os == 'Linux'
run: |
while read -r file; do
commit="$(git -C "$file" rev-parse HEAD)"
if ! branch="$(git config -f .gitmodules --get "submodule.$file.branch")"; then
echo "Submodule '$file': '.gitmodules' lacks 'branch' entry"
exit 2
fi
if ! error="$(git -C "$file" fetch -q origin "$branch")"; then
echo "Submodule '$file': Failed to fetch '$branch': $error"
exit 2
fi
if ! git -C "$file" merge-base --is-ancestor "$commit" "origin/$branch"; then
echo "Submodule '$file': '$commit' is not on '$branch'"
exit 2
fi
done < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep -f <(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') || true)

- name: Get latest fixtures commit hash
id: fixtures_version
run: |
Expand Down Expand Up @@ -223,13 +179,64 @@ jobs:
name: Unit Test Results ${{ matrix.target.os }}-${{ matrix.target.cpu }}
path: build/*.xml

lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2 # In PR, has extra merge commit: ^1 = PR, ^2 = base
submodules: 'recursive'

- name: Check copyright year
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
run: |
excluded_files="config.yaml"
excluded_extensions="ans|json|md|png|ssz|txt"

current_year=$(date +"%Y")
outdated_files=()
while read -r file; do
if ! grep -qE 'Copyright \(c\) .*'$current_year' Status Research & Development GmbH' "$file"; then
outdated_files+=("$file")
fi
done < <(git diff --name-only --diff-filter=AM --ignore-submodules HEAD^ HEAD | grep -vE '(\.('$excluded_extensions')|'$excluded_files')$' || true)

if (( ${#outdated_files[@]} )); then
echo "The following files do not have an up-to-date copyright year:"
for file in "${outdated_files[@]}"; do
echo "- $file"
done
exit 2
fi

- name: Check submodules
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
run: |
while read -r file; do
commit="$(git -C "$file" rev-parse HEAD)"
if ! branch="$(git config -f .gitmodules --get "submodule.$file.branch")"; then
echo "Submodule '$file': '.gitmodules' lacks 'branch' entry"
exit 2
fi
if ! error="$(git -C "$file" fetch -q origin "$branch")"; then
echo "Submodule '$file': Failed to fetch '$branch': $error"
exit 2
fi
if ! git -C "$file" merge-base --is-ancestor "$commit" "origin/$branch"; then
echo "Submodule '$file': '$commit' is not on '$branch'"
exit 2
fi
done < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep -f <(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') || true)

# https://github.com/EnricoMi/publish-unit-test-result-action
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}