Skip to content

Commit a7181c6

Browse files
committed
Add Github action for checks and publishing
1 parent d564020 commit a7181c6

File tree

3 files changed

+98
-0
lines changed

3 files changed

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

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
16+
echo "Executing: ${cmd}; in $(pwd)"
17+
$cmd || exit
18+
cd ../scudo-sys || exit
19+
echo "Executing: ${cmd}; in $(pwd)"
20+
$cmd || exit
21+
cd ../scudo || exit
22+
echo "Executing: ${cmd}; in $(pwd)"
23+
$cmd || exit
24+
cd .. || exit

0 commit comments

Comments
 (0)