Skip to content

Commit

Permalink
Add Github action for checks and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
1c3t3a committed Dec 20, 2022
1 parent d564020 commit a7181c6
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
on:
push:
branches:
- "main"
pull_request:

name: check
jobs:
fmt:
runs-on: ubuntu-latest
name: Check
permissions:
checks: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
- name: cargo fmt --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check
- name: cargo clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

test:
runs-on: ubuntu-latest
name: Run test suite
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
default: true
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
- name: Run abort tests
run: ./abort_tests.sh
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
release:
types: [published]
workflow_dispatch:

name: publish
jobs:
publish:
runs-on: ubuntu-latest
name: Publish
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: cargo login ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- run: ./publish.sh --dry-run
24 changes: 24 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# This script will publish all crates in this repository. This script also provides
# a `--dry-run` option that runs `cargo publish` with the dry-run option.

cmd="cargo publish"
if [ "$1" == "--dry-run" ]; then
cmd="${cmd} --dry-run"
fi

cd scudo-proc-macros || exit
echo "Executing: ${cmd}; in $(pwd)"
$cmd || exit
cd ../scudo-sys || exit
echo "Executing: ${cmd}; in $(pwd)"
$cmd || exit
cd ../scudo || exit
echo "Executing: ${cmd}; in $(pwd)"
$cmd || exit
cd .. || exit

0 comments on commit a7181c6

Please sign in to comment.