comparison .github/workflows/build.yml @ 43:60e74d6a2b88

Merge pull request #10 from Nigma1337/master Automate crate publishing
author Anthony Nowell <anowell@gmail.com>
date Mon, 29 Aug 2022 14:32:28 -0700
parents 80d496e87f8f
children
comparison
equal deleted inserted replaced
35:3b2ff50db010 43:60e74d6a2b88
1 on: 1 on:
2 pull_request: 2 push:
3 branches: 3 branches:
4 - master 4 - master
5 workflow_call: 5 workflow_call:
6 6
7 name: Build 7 name: Build & publish
8 8
9 jobs: 9 jobs:
10 check: 10 build:
11 name: Check & Lint
12 runs-on: ubuntu-latest 11 runs-on: ubuntu-latest
13 steps: 12 steps:
14 - name: Checkout sources 13 - name: Checkout sources
15 uses: actions/checkout@v2 14 uses: actions/checkout@v2
16
17 - name: Install PAM dev files 15 - name: Install PAM dev files
18 run: sudo apt-get install -y libpam0g-dev 16 run: sudo apt-get install -y libpam0g-dev
19
20 - name: Use cargo cache 17 - name: Use cargo cache
21 uses: actions/cache@v2 18 uses: actions/cache@v2
22 with: 19 with:
23 path: | 20 path: |
24 ~/.cargo/bin/ 21 ~/.cargo/bin/
25 ~/.cargo/registry/index/ 22 ~/.cargo/registry/index/
26 ~/.cargo/registry/cache/ 23 ~/.cargo/registry/cache/
27 ~/.cargo/git/db/ 24 ~/.cargo/git/db/
28 target/ 25 target/
29 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 26 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
30
31 - name: Install stable toolchain 27 - name: Install stable toolchain
32 uses: actions-rs/toolchain@v1 28 uses: actions-rs/toolchain@v1
33 with: 29 with:
34 profile: minimal 30 profile: minimal
35 toolchain: stable 31 toolchain: stable
36 override: true 32 override: true
37 33 - name: Publish module
38 - name: Run cargo check 34 uses: katyo/publish-crates@v1
39 uses: actions-rs/cargo@v1
40 with: 35 with:
41 command: check 36 registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
42 args: --manifest-path pam/Cargo.toml 37 check-repo: ${{ github.event_name == 'push' }}
43 38 ignore-unpublished-changes: true
44 - name: Run cargo test 39 # Only publish pam module, as pam-http and pam-sober are example projects
45 uses: actions-rs/cargo@v1 40 path: pam
46 with: 41 args: --package pam-bindings
47 command: test
48 args: --manifest-path pam/Cargo.toml
49
50 - name: Run cargo check on pam-http
51 uses: actions-rs/cargo@v1
52 with:
53 command: check
54 args: --manifest-path pam-http/Cargo.toml
55
56 - name: Run cargo check on pam-sober
57 uses: actions-rs/cargo@v1
58 with:
59 command: check
60 args: --manifest-path pam-sober/Cargo.toml
61
62 - name: Run cargo fmt
63 uses: actions-rs/cargo@v1
64 with:
65 command: fmt
66 args: --manifest-path pam/Cargo.toml --all --check
67
68 - name: Run cargo clippy
69 uses: actions-rs/cargo@v1
70 with:
71 command: clippy
72 args: --manifest-path pam/Cargo.toml -- -D warnings
73
74