This repository has been archived by the owner on Jan 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (89 loc) · 2.59 KB
/
ci.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
name: CI
on:
push:
branches-ignore: [deploy]
pull_request:
branches: [main]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust-version: ['1.65.0', 'stable']
steps:
- name: Checkout pkgcraft-bash
uses: actions/checkout@v3
with:
submodules: true
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@master
id: rust
with:
toolchain: ${{ matrix.rust-version }}
- name: Set up rust cache
uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target
key: ${{ github.job }}-${{ runner.os }}-rust-${{ steps.rust.outputs.cachekey }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-rust-
- name: Various macos set up
if: runner.os == 'macOS'
run: |
# force using clang as a C compiler
echo "CC=clang" >> $GITHUB_ENV
echo "CFLAGS=-arch x86_64" >> $GITHUB_ENV
# install newer bash -- macos defaults to ancient bash due to licensing
brew install bash
- name: Build builtins
run: |
# first build with default features enabled
cargo build
# then with all features enabled
cargo build --all-features
# export variables required to run tests
echo "CARGO_BUILD_DIR=${PWD}/target/debug" >> $GITHUB_ENV
- name: Output bash info
run: bash --version
- name: Install bats test framework
uses: mig4/setup-bats@v1
with:
bats-version: 1.7.0
- name: Run tests
run: bats -r tests
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout pkgcraft-bash
uses: actions/checkout@v3
with:
submodules: true
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@stable
id: rust
with:
components: clippy, rustfmt
- name: Set up rust cache
uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target
key: ${{ github.job }}-${{ runner.os }}-rust-${{ steps.rust.outputs.cachekey }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-rust-
- name: Run rustfmt
run: cargo fmt --check
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}