-
Notifications
You must be signed in to change notification settings - Fork 139
153 lines (130 loc) · 4.14 KB
/
test_ci.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Test
on:
push:
branches:
- '*'
tags-ignore:
- 'v*'
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
strategy:
matrix:
# setup different OS and targets
include:
- name: ubuntu_20_04-x86_64
os: ubuntu-20.04
TARGET_CPU: x86-64
- name: ubuntu_22_04-x86_64
os: ubuntu-22.04
TARGET_CPU: x86-64
- name: osx_11-x86_64
os: macos-11
TARGET_CPU: nehalem
- name: win-x86_64
os: windows-2019
TARGET_CPU: x86-64
- name: ubuntu_20_04-x86_64-haswell
os: ubuntu-20.04
TARGET_CPU: haswell
- name: win-x86_64-haswell
os: windows-2019
TARGET_CPU: haswell
- name: osx_14-aarch64
os: macos-14
TARGET_CPU: apple-m1
runs-on: ${{matrix.os}}
steps:
- run: rustup show
- name: Checkout code
uses: actions/checkout@v3
- run: rustup update stable
if: ${{contains( matrix.os, 'macos' )}}
### Cargo Cache for Build Artifacts ###
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{matrix.name}}-cargo-${{ hashFiles('**/Cargo.lock') }}
### Install Nasm for MacOS ###
- name: Install nasm
run: brew install nasm
if: ${{contains( matrix.os, 'macos' )}}
### Install Nasm for Windows ###
- name: Install nasm
run: choco install nasm
if: ${{contains( matrix.os, 'windows' )}}
### Fallback in case Nasm install fails ###
- name: Install nasm
run: |
curl -L -o nasminst.exe https://imageflow-resources.s3-us-west-2.amazonaws.com/tools/nasm-2.15.05-installer-x64.exe
.\nasminst.exe /S
if: ${{contains( matrix.os, 'windows' ) && failure()}}
### Set Path for nasm install ###
- name: Set Path
run: |
echo "C:\Program Files\NASM" >> $GITHUB_PATH
echo "C:\Program Files (x86)\NASM" >> $GITHUB_PATH
if: ${{contains( matrix.os, 'windows' )}}
shell: bash
### Install Nasm for Ubuntu ###
- name: Install nasm
run: sudo apt install nasm
if: ${{contains( matrix.os, 'ubuntu' )}}
### Check Build ###
- name: Check Build
run: cargo check --all
### Test Code ###
- name: Test Build
run: cargo test --all
env:
RUSTFLAGS: -C target-cpu=${{matrix.TARGET_CPU}}
### Build the code ###
- name: Build Release
run: cargo build --all
shell: bash
env:
RUSTFLAGS: -C target-cpu=${{matrix.TARGET_CPU}}
test_win32:
runs-on: windows-2019
steps:
- run: rustup show
- name: Checkout code
uses: actions/checkout@v3
### Install Nasm with fallback to S3 ###
- name: Install nasm
run: choco install nasm
- name: Install nasm
run: |
curl -L -o nasminst.exe https://imageflow-resources.s3-us-west-2.amazonaws.com/tools/nasm-2.15.05-installer-x86.exe
.\nasminst.exe /S
if: ${{failure()}}
- name: Set Path
run: |
echo "C:\Program Files\NASM" >> $GITHUB_PATH
echo "C:\Program Files (x86)\NASM" >> $GITHUB_PATH
shell: bash
### Cargo cache for Build artifacts ###
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-windows-test-32-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install latest 32bit target
uses: dtolnay/rust-toolchain@stable
with:
#components: rustfmt, clippy
target: i686-pc-windows-msvc
### check and test build ###
- name: Check Build
run: cargo check --all --target=i686-pc-windows-msvc
- name: Test Build
run: cargo test --all --release --target=i686-pc-windows-msvc