-
Notifications
You must be signed in to change notification settings - Fork 137
130 lines (118 loc) · 3.77 KB
/
check-loser-homework.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Check loser homework
on:
workflow_call:
inputs:
docker_namespaces:
required: true
type: string
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- '.github/actions/**'
- '.github/workflows/check-loser-homework.yml'
- '**.cmake'
- '**/CMakeLists.txt'
- 'src/群友提交/**'
pull_request:
branches: [ "main" ]
paths:
- '.github/actions/**'
- '.github/workflows/check-loser-homework.yml'
- '**.cmake'
- '**/CMakeLists.txt'
- 'src/群友提交/**'
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
need_build_all: ${{ steps.changed-files.outputs.any_changed == 'true' ||
( github.event_name != 'pull_request' && github.event_name != 'push' ) }}
docker_namespaces: ${{ inputs.docker_namespaces == '' && 'mq-b/loser-homework' || inputs.docker_namespaces}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the changed files that need to build all
id: changed-files
uses: tj-actions/changed-files@v42
with:
separator: ";"
quotepath: false
safe_output: false
files: |
.github/actions/**
.github/workflows/check-loser-homework.yml
**.cmake
**/CMakeLists.txt
src/群友提交/script/**
src/群友提交/**/input.txt
src/群友提交/**/output.txt
check:
needs: prepare
env:
PYTHONIOENCODING: "utf-8"
DOTNET_CLI_FORCE_UTF8_ENCODING: "true"
strategy:
matrix:
include:
- name: GCC-14
os: ubuntu-24.04
cxx_compiler: g++-14
c_compiler: gcc-14
shell: bash
use-ninja: true
- name: Clang-17
os: ubuntu-24.04
cxx_compiler: clang++-17
c_compiler: clang-17
cxx_flags: -stdlib=libc++
container: ghcr.io/${{ needs.prepare.outputs.docker_namespaces }}/clang17
shell: bash
use-ninja: true
- name: MSVC
os: windows-2022
cxx_compiler: cl
c_compiler: cl
shell: pwsh
use-ninja: true
name: check in ${{ matrix.name }}
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.container }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- uses: actions/checkout@v4
- name: delete unchanged cpp files
if: |
needs.prepare.outputs.need_build_all == 'false'
uses: ./.github/actions/delete-unchanged-cpp-files
with:
path: src/群友提交
shell: ${{ matrix.shell }}
- name: rename evil cjk path
if: ${{ matrix.os == 'windows-2022' }}
run: |
Rename-Item "src/群友提交" -NewName "hw-submit"
$cmakeLists = Get-ChildItem -Recurse -Filter "CMakeLists.txt"
foreach ($file in $cmakeLists) {
$content = Get-Content -Path $file.FullName -encoding UTF8
$newContent = $content -replace "群友提交", "hw-submit"
Set-Content -Path $file.FullName -Value $newContent
}
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
if: ${{ matrix.os == 'windows-2022' }}
- name: Check loser homework
uses: ./.github/actions/check-loser-homework
with:
build-path: ${{github.workspace}}/build
extra-gen-params: >
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
shell: ${{ matrix.shell }}
use-ninja: ${{ matrix.use-ninja }}