forked from hashcat/hashcat
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (137 loc) · 4.85 KB
/
Copy pathbuild.yml
File metadata and controls
148 lines (137 loc) · 4.85 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Build
env:
include_paths: |
charsets/
docs/
extra/
layouts/
masks/
modules/
OpenCL/
rules/
example*
hashcat*
libhashcat*
on:
push:
branches:
- master
tags:
- v*
paths:
- 'OpenCL/**.h'
- 'OpenCL/**.cl'
- 'include/**.h'
- 'src/**.c'
- 'src/**.mk'
- 'tools/**'
- '**/Makefile'
- '.github/workflows/build.yml'
pull_request:
branches:
- master
paths:
- 'OpenCL/**.h'
- 'OpenCL/**.cl'
- 'include/**.h'
- 'src/**.c'
- 'src/**.mk'
- 'tools/**'
- '**/Makefile'
- '.github/workflows/build.yml'
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
shared: [0, 1]
include:
- os: ubuntu-latest
os_name: Linux
os_name_lowercase: linux
- os: macos-latest
os_name: macOS
os_name_lowercase: macos
- os: windows-latest
os_name: Windows
os_name_lowercase: windows
name: Build ${{ matrix.os_name }} (${{ matrix.shared == 0 && 'Static' || 'Shared' }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
- name: Install dependencies (Windows only)
if: matrix.os_name_lowercase == 'windows'
uses: msys2/setup-msys2@v2
with:
update: true
install: |
gcc
git
libiconv
libiconv-devel
make
python
- name: Build (Windows)
if: matrix.os_name_lowercase == 'windows'
shell: msys2 {0}
env:
SHARED: ${{ matrix.shared }}
run: make
- name: Build (Linux/macOS)
if: matrix.os_name_lowercase != 'windows'
env:
SHARED: ${{ matrix.shared }}
run: make
- name: Run --help and save to docs/hashcat-help.md
if: matrix.os_name_lowercase == 'linux' && matrix.shared == 0
env:
SHARED: ${{ matrix.shared }}
run: |
echo 'These docs are automatically generated by Github Actions see .github/workflows/build.yml \' > docs/hashcat-help.md
echo 'All manual changes will be overwritten!' >> docs/hashcat-help.md
echo '```' >> docs/hashcat-help.md
./hashcat --help >> docs/hashcat-help.md
echo '```' >> docs/hashcat-help.md
- name: Run --example-hashes and save to docs/hashcat-example-hashes.md
if: matrix.os_name_lowercase == 'linux' && matrix.shared == 0
env:
SHARED: ${{ matrix.shared }}
run: |
echo 'These docs are automatically generated by Github Actions see .github/workflows/build.yml \' > docs/hashcat-example-hashes.md
echo 'All manual changes will be overwritten!' >> docs/hashcat-example-hashes.md
echo '| Hash-mode | Hash-name | Kernels | Example |' >> docs/hashcat-example-hashes.md
echo '|:-----------|:-----------|:-----------|:---------------|' >> docs/hashcat-example-hashes.md
./hashcat --example-hashes --machine-readable --quiet | python3 docs/hashcat-example-hashes_machine-readable2md.py >> docs/hashcat-example-hashes.md
- name: Commit changes to docs
if: matrix.os_name_lowercase == 'linux' && matrix.shared == 0
env:
SHARED: ${{ matrix.shared }}
run: |
# https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs/hashcat-help.md
git add docs/hashcat-example-hashes.md
if ! git diff --staged --quiet; then
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
git commit -m "Automatically updated docs/hashcat-help.md or docs/hashcat-example-hashes.md (by Github Action)"
git push
else
echo "docs/hashcat-help.md or docs/hashcat-example-hashes.md are not up-to-date:"
echo "..."
git diff --staged | cat
echo "..."
echo "this will be updated automatically when merged into master"
fi
else
echo "No need to update docs/hashcat-help.md or docs/hashcat-example-hashes.md"
fi
- name: Generate artifacts
uses: actions/upload-artifact@v4
with:
name: hashcat-${{ matrix.os_name_lowercase }}-${{ matrix.shared == 0 && 'static' || 'shared' }}
path: ${{ env.include_paths }}