Skip to content

Commit d49f6a9

Browse files
authored
Add Github action (#5)
This change adds a GH action that checks formatting and runs cargo clippy as well as the current test suite.
1 parent 28d60d9 commit d49f6a9

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

.github/workflows/check.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on:
2+
push:
3+
branches:
4+
- "main"
5+
pull_request:
6+
7+
name: check
8+
jobs:
9+
fmt:
10+
runs-on: ubuntu-latest
11+
name: Check
12+
permissions:
13+
checks: write
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
submodules: true
18+
- name: Install stable
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
profile: minimal
22+
toolchain: stable
23+
components: rustfmt
24+
- name: cargo fmt --check
25+
uses: actions-rs/cargo@v1
26+
with:
27+
command: fmt
28+
args: --check
29+
- name: cargo clippy
30+
uses: actions-rs/clippy-check@v1
31+
with:
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
name: Run test suite
37+
steps:
38+
- uses: actions/checkout@v3
39+
with:
40+
submodules: true
41+
- name: Install nightly
42+
uses: actions-rs/toolchain@v1
43+
with:
44+
profile: minimal
45+
toolchain: nightly
46+
default: true
47+
- name: cargo test
48+
uses: actions-rs/cargo@v1
49+
with:
50+
command: test
51+
args: --all-features
52+
- name: Run abort tests
53+
run: ./abort_tests.sh

.github/workflows/publish.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on:
2+
release:
3+
types: [published]
4+
workflow_dispatch:
5+
6+
name: publish
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
name: Publish
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions-rs/toolchain@v1
14+
with:
15+
toolchain: stable
16+
override: true
17+
- run: cargo login ${CRATES_IO_TOKEN}
18+
env:
19+
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
20+
- run: ./publish.sh

publish.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3+
# See the License for the specific language governing permissions and
4+
# limitations under the License.
5+
#
6+
#
7+
# This script will publish all crates in this repository. This script also provides
8+
# a `--dry-run` option that runs `cargo publish` with the dry-run option.
9+
10+
cmd="cargo publish"
11+
if [ "$1" == "--dry-run" ]; then
12+
cmd="${cmd} --dry-run"
13+
fi
14+
15+
cd scudo-proc-macros || exit 1
16+
echo "Executing: ${cmd}; in $(pwd)"
17+
$cmd || exit 1
18+
cd ../scudo-sys || exit 1
19+
echo "Executing: ${cmd}; in $(pwd)"
20+
$cmd || exit 1
21+
cd ../scudo || exit 1
22+
echo "Executing: ${cmd}; in $(pwd)"
23+
$cmd || exit 1
24+
cd .. || exit 1

0 commit comments

Comments
 (0)