|
57 | 57 | steps: |
58 | 58 | - name: Checkout |
59 | 59 | uses: actions/checkout@v3 |
60 | | - with: |
61 | | - fetch-depth: 2 # In PR, has extra merge commit: ^1 = PR, ^2 = base |
62 | | - # submodules: true # Fails on nimyaml tests |
63 | | - |
64 | | - - name: Check copyright year (Linux) |
65 | | - if: github.event_name == 'pull_request' && runner.os == 'Linux' |
66 | | - run: | |
67 | | - excluded_files="config.yaml" |
68 | | - excluded_extensions="ans|json|md|png|ssz|txt" |
69 | | -
|
70 | | - current_year=$(date +"%Y") |
71 | | - outdated_files=() |
72 | | - while read -r file; do |
73 | | - if ! grep -qE 'Copyright \(c\) .*'$current_year' Status Research & Development GmbH' "$file"; then |
74 | | - outdated_files+=("$file") |
75 | | - fi |
76 | | - done < <(git diff --name-only --diff-filter=AM --ignore-submodules HEAD^ HEAD | grep -vE '(\.('$excluded_extensions')|'$excluded_files')$' || true) |
77 | | -
|
78 | | - if (( ${#outdated_files[@]} )); then |
79 | | - echo "The following files do not have an up-to-date copyright year:" |
80 | | - for file in "${outdated_files[@]}"; do |
81 | | - echo "- $file" |
82 | | - done |
83 | | - exit 2 |
84 | | - fi |
85 | 60 |
|
86 | 61 | - name: MSYS2 (Windows amd64) |
87 | 62 | if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' |
@@ -164,25 +139,6 @@ jobs: |
164 | 139 | ${make_cmd} -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update |
165 | 140 | ./env.sh nim --version |
166 | 141 |
|
167 | | - - name: Check submodules (Linux) |
168 | | - if: github.event_name == 'pull_request' && runner.os == 'Linux' |
169 | | - run: | |
170 | | - while read -r file; do |
171 | | - commit="$(git -C "$file" rev-parse HEAD)" |
172 | | - if ! branch="$(git config -f .gitmodules --get "submodule.$file.branch")"; then |
173 | | - echo "Submodule '$file': '.gitmodules' lacks 'branch' entry" |
174 | | - exit 2 |
175 | | - fi |
176 | | - if ! error="$(git -C "$file" fetch -q origin "$branch")"; then |
177 | | - echo "Submodule '$file': Failed to fetch '$branch': $error" |
178 | | - exit 2 |
179 | | - fi |
180 | | - if ! git -C "$file" merge-base --is-ancestor "$commit" "origin/$branch"; then |
181 | | - echo "Submodule '$file': '$commit' is not on '$branch'" |
182 | | - exit 2 |
183 | | - fi |
184 | | - done < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep -f <(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') || true) |
185 | | -
|
186 | 142 | - name: Get latest fixtures commit hash |
187 | 143 | id: fixtures_version |
188 | 144 | run: | |
@@ -223,13 +179,64 @@ jobs: |
223 | 179 | name: Unit Test Results ${{ matrix.target.os }}-${{ matrix.target.cpu }} |
224 | 180 | path: build/*.xml |
225 | 181 |
|
| 182 | + lint: |
| 183 | + name: "Lint" |
| 184 | + runs-on: ubuntu-latest |
| 185 | + steps: |
| 186 | + - name: Checkout |
| 187 | + uses: actions/checkout@v3 |
| 188 | + with: |
| 189 | + fetch-depth: 2 # In PR, has extra merge commit: ^1 = PR, ^2 = base |
| 190 | + submodules: 'recursive' |
| 191 | + |
| 192 | + - name: Check copyright year |
| 193 | + if: ${{ !cancelled() }} && github.event_name == 'pull_request' |
| 194 | + run: | |
| 195 | + excluded_files="config.yaml" |
| 196 | + excluded_extensions="ans|json|md|png|ssz|txt" |
| 197 | +
|
| 198 | + current_year=$(date +"%Y") |
| 199 | + outdated_files=() |
| 200 | + while read -r file; do |
| 201 | + if ! grep -qE 'Copyright \(c\) .*'$current_year' Status Research & Development GmbH' "$file"; then |
| 202 | + outdated_files+=("$file") |
| 203 | + fi |
| 204 | + done < <(git diff --name-only --diff-filter=AM --ignore-submodules HEAD^ HEAD | grep -vE '(\.('$excluded_extensions')|'$excluded_files')$' || true) |
| 205 | +
|
| 206 | + if (( ${#outdated_files[@]} )); then |
| 207 | + echo "The following files do not have an up-to-date copyright year:" |
| 208 | + for file in "${outdated_files[@]}"; do |
| 209 | + echo "- $file" |
| 210 | + done |
| 211 | + exit 2 |
| 212 | + fi |
| 213 | +
|
| 214 | + - name: Check submodules |
| 215 | + if: ${{ !cancelled() }} && github.event_name == 'pull_request' |
| 216 | + run: | |
| 217 | + while read -r file; do |
| 218 | + commit="$(git -C "$file" rev-parse HEAD)" |
| 219 | + if ! branch="$(git config -f .gitmodules --get "submodule.$file.branch")"; then |
| 220 | + echo "Submodule '$file': '.gitmodules' lacks 'branch' entry" |
| 221 | + exit 2 |
| 222 | + fi |
| 223 | + if ! error="$(git -C "$file" fetch -q origin "$branch")"; then |
| 224 | + echo "Submodule '$file': Failed to fetch '$branch': $error" |
| 225 | + exit 2 |
| 226 | + fi |
| 227 | + if ! git -C "$file" merge-base --is-ancestor "$commit" "origin/$branch"; then |
| 228 | + echo "Submodule '$file': '$commit' is not on '$branch'" |
| 229 | + exit 2 |
| 230 | + fi |
| 231 | + done < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep -f <(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') || true) |
| 232 | +
|
226 | 233 | # https://github.com/EnricoMi/publish-unit-test-result-action |
227 | 234 | event_file: |
228 | 235 | name: "Event File" |
229 | 236 | runs-on: ubuntu-latest |
230 | 237 | steps: |
231 | | - - name: Upload |
232 | | - uses: actions/upload-artifact@v3 |
233 | | - with: |
234 | | - name: Event File |
235 | | - path: ${{ github.event_path }} |
| 238 | + - name: Upload |
| 239 | + uses: actions/upload-artifact@v3 |
| 240 | + with: |
| 241 | + name: Event File |
| 242 | + path: ${{ github.event_path }} |
0 commit comments