-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (96 loc) · 4.34 KB
/
build.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
name: Build
on:
release:
types: [published]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
strategy:
matrix:
backend: [ "hashes_backend", "ring_backend", "mix_backend" ]
config:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-unknown-linux-musl, os: ubuntu-latest }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-latest }
- { target: aarch64-unknown-linux-musl, os: ubuntu-latest }
- { target: i686-unknown-linux-gnu, os: ubuntu-latest }
- { target: loongarch64-unknown-linux-gnu, os: ubuntu-latest }
- { target: loongarch64-unknown-linux-musl, os: ubuntu-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: x86_64-pc-windows-gnu, os: windows-latest }
- { target: i686-pc-windows-msvc, os: windows-latest }
- { target: i686-pc-windows-gnu, os: windows-latest }
- { target: aarch64-pc-windows-msvc, os: windows-latest }
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
name: ${{ matrix.config.target }}-${{ matrix.backend }}
runs-on: ${{ matrix.config.os }}
permissions:
contents: write
continue-on-error: true
steps:
- uses: actions/checkout@v4
- if: matrix.config.os == 'macos-latest'
run: brew install coreutils
- name: Install mingw32
if: matrix.config.target == 'i686-pc-windows-gnu'
run: |
Invoke-WebRequest -Uri https://github.com/niXman/mingw-builds-binaries/releases/download/14.2.0-rt_v12-rev0/i686-14.2.0-release-posix-dwarf-msvcrt-rt_v12-rev0.7z -OutFile mingw32.7z
7z x mingw32.7z -oC:\mingw32
echo "C:\mingw32\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.config.target }}
- name: Install cross
if: matrix.config.os == 'ubuntu-latest'
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
if: matrix.config.os == 'ubuntu-latest'
run: cross build --release --no-default-features --features ${{ matrix.backend }} --target ${{ matrix.config.target }}
- name: Build
if: matrix.config.os != 'ubuntu-latest'
run: cargo build --release --no-default-features --features ${{ matrix.backend }} --target ${{ matrix.config.target }}
- if: matrix.config.os == 'windows-latest'
run: |
mkdir ezcheck
cp target/${{matrix.config.target}}/release/ezcheck.exe ezcheck/
- if: matrix.config.os != 'windows-latest'
run: |
mkdir ezcheck
cp target/${{matrix.config.target}}/release/ezcheck ezcheck/
- name: Add license and Gerenate sha256
run: |
cp LICENSE ezcheck/
cd ezcheck
sha256sum ezcheck* > sha256sum.txt
sha256sum LICENSE >> sha256sum.txt
- if: matrix.config.os == 'windows-latest'
run: Compress-Archive -Path .\ezcheck\* -DestinationPath .\ezcheck-${{ matrix.config.target }}-${{ matrix.backend }}.zip
- if: matrix.config.os != 'windows-latest'
run: tar -czvf ezcheck-${{ matrix.config.target }}-${{ matrix.backend }}.tar.gz -C ezcheck .
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ezcheck-${{ matrix.config.target }}-${{ matrix.backend }}
path: ezcheck/*
- name: Upload to GitHub Release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && matrix.config.os == 'windows-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file: ezcheck-${{ matrix.config.target }}-${{ matrix.backend }}.zip
- name: Upload to GitHub Release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && matrix.config.os != 'windows-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file: ezcheck-${{ matrix.config.target }}-${{ matrix.backend }}.tar.gz