-
Notifications
You must be signed in to change notification settings - Fork 2
173 lines (164 loc) · 5.51 KB
/
rust.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Rust
on:
push:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
#RUSTFLAGS: -D warnings
jobs:
build-test-win:
#if: ${{ false }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Install stable toolchain (windows)
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-gnu
override: true
- name: Setup (windows)
run: |
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:PATH"
echo "PATH=${env:PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CARGO_BUILD_TARGET=x86_64-pc-windows-gnu" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build (windows)
run: |
cargo clean
cargo build
- name: Test (windows)
run: |
cargo test
build-test-msvc:
#if: ${{ false }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Install stable toolchain (windows)
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-msvc
override: true
- name: Setup (windows)
run: |
echo "CARGO_BUILD_TARGET=x86_64-pc-windows-msvc" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build (windows)
run: |
cargo clean
cargo build --no-default-features --features quickjs-ng
- name: Test (windows)
run: |
cargo test --no-default-features --features quickjs-ng
build-test-mac:
runs-on: macOs-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
run: |
sudo apt update
sudo apt install ccache llvm autoconf2.13 automake clang valgrind -y
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Ccache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{ runner.OS }}-ccache-${{ hashFiles('**\Cargo.toml') }}
- name: Build
run: |
export SHELL=/bin/bash
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
ccache -z
CCACHE=$(which ccache) cargo build --verbose
ccache -s
cargo clean
- name: Format
run: |
cargo fmt
- name: Commit fmt files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "autofmt" -a || true
git push "https://${{ github.actor }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:${{ github.ref }} || true
- name: Doc
run: |
cargo doc
- name: Commit docs
run: |
cp -r ./target/doc /tmp
cd /tmp/doc
git init
echo '<!DOCTYPE html><html><head><title>Redirect</title><meta http-equiv = "refresh" content = "0; url = https://hirofa.github.io/quickjs_es_runtime/quickjs_runtime/index.html" /></head><body><p>Redirecting</p></body></html>' >> index.html
git add .
git remote add origin https://github.com/${{ github.repository }}.git
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "doc" -a || true
git push "https://${{ github.actor }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:gh-pages --force || true
- name: Deploy to gh-pages
run: |
curl -X POST https://api.github.com/repos/${{ github.repository }}/pages/builds -H "Accept: application/vnd.github.mister-fantastic-preview+json" -u ${{ github.actor }}:${{ secrets.GH_TOKEN }}
- name: Run tests
run: cargo test --verbose
with:
token: ${{ secrets.GITHUB_TOKEN }}
test-and-valgrind:
if: ${{ false }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
run: |
sudo apt update
sudo apt install ccache llvm autoconf2.13 automake clang valgrind -y
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Ccache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{ runner.OS }}-ccache-${{ hashFiles('**\Cargo.toml') }}
- name: Build
run: |
export SHELL=/bin/bash
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
ccache -z
CCACHE=$(which ccache) cargo build --verbose
ccache -s
cargo clean
cargo build
- name: Run tests
run: cargo test --verbose
- name: Valgrind
run: |
find ./target/debug/deps/quickjs_runtime-* -maxdepth 1 -type f -executable | xargs valgrind --leak-check=full --error-exitcode=1