• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2on:
3  pull_request:
4  push:
5    branches:
6      - master
7
8env:
9  RUST_BACKTRACE: 1
10  CARGO_TERM_COLOR: always
11
12jobs:
13  ci-pass:
14    name: CI is green
15    runs-on: ubuntu-latest
16    needs:
17      - msrv
18      - test-linux
19      - test-macos
20      - test-windows
21      - build-cross
22      - test-cgroups
23    steps:
24      - run: exit 0
25
26  msrv:
27    runs-on: ubuntu-latest
28
29    strategy:
30      matrix:
31        rust:
32          - 1.13
33        target:
34          - x86_64-unknown-linux-gnu
35
36    steps:
37    - uses: actions/checkout@v2
38    - name: Run tests
39      run: |
40        rustup default ${{ matrix.rust }}
41        rustup target add ${{ matrix.target }}
42        cargo test --verbose --target ${{ matrix.target }}
43
44  test-linux:
45    runs-on: ubuntu-latest
46
47    strategy:
48      matrix:
49        rust:
50          - stable
51          - beta
52          - nightly
53        target:
54          - x86_64-unknown-linux-gnu
55          - x86_64-unknown-linux-musl
56
57    steps:
58    - uses: actions/checkout@v2
59    - name: Run tests
60      run: |
61        rustup default ${{ matrix.rust }}
62        rustup target add ${{ matrix.target }}
63        cargo test --verbose --target ${{ matrix.target }}
64
65  test-macos:
66    runs-on: macos-latest
67
68    strategy:
69      matrix:
70        rust:
71          - stable
72          - beta
73          - nightly
74        target:
75          - x86_64-apple-darwin
76
77    steps:
78    - uses: actions/checkout@v2
79    - name: Run tests
80      run: |
81        rustup default ${{ matrix.rust }}
82        rustup target add ${{ matrix.target }}
83        cargo test --verbose --target ${{ matrix.target }}
84
85  test-windows:
86    runs-on: windows-latest
87
88    strategy:
89      matrix:
90        rust:
91          - stable
92          - beta
93          - nightly
94        target:
95          - x86_64-pc-windows-gnu
96          - x86_64-pc-windows-msvc
97
98    steps:
99    - uses: actions/checkout@v2
100    - name: Run tests
101      run: |
102        rustup default ${{ matrix.rust }}
103        rustup target add ${{ matrix.target }}
104        cargo test --verbose --target ${{ matrix.target }}
105
106  build-cross:
107    runs-on: ubuntu-latest
108
109    strategy:
110      matrix:
111        rust:
112          - stable
113        target:
114          - aarch64-unknown-linux-gnu
115          - i686-pc-windows-gnu
116          - i686-pc-windows-msvc
117          - i686-unknown-linux-gnu
118          - aarch64-apple-darwin
119          - aarch64-pc-windows-msvc
120          - aarch64-unknown-linux-musl
121          - arm-unknown-linux-gnueabi
122          - arm-unknown-linux-gnueabihf
123          - armv7-unknown-linux-gnueabihf
124          - mips-unknown-linux-gnu
125          - mips64-unknown-linux-gnuabi64
126          - mips64el-unknown-linux-gnuabi64
127          - mipsel-unknown-linux-gnu
128          - powerpc-unknown-linux-gnu
129          - powerpc64-unknown-linux-gnu
130          - powerpc64le-unknown-linux-gnu
131          - riscv64gc-unknown-linux-gnu
132          - s390x-unknown-linux-gnu
133          - x86_64-unknown-freebsd
134          - x86_64-unknown-illumos
135          - x86_64-unknown-netbsd
136          - i686-linux-android
137          - x86_64-linux-android
138          - arm-linux-androideabi
139          - aarch64-linux-android
140          - x86_64-apple-ios
141          - asmjs-unknown-emscripten
142          - aarch64-apple-ios
143          - aarch64-apple-ios-sim
144          - aarch64-apple-darwin
145    steps:
146    - uses: actions/checkout@v2
147    - name: Run build
148      run: |
149        rustup default ${{ matrix.rust }}
150        rustup target add ${{ matrix.target }}
151        cargo build --verbose --target ${{ matrix.target }}
152
153  test-cgroups:
154    runs-on: ubuntu-latest
155
156    steps:
157    - uses: actions/checkout@v2
158    - name: Test Cgroup
159      run: |
160        docker build -f ci/cgroups/Dockerfile -t num-cpus-cgroups .
161        # Test without cgroups
162        docker run -e NUM_CPUS_TEST_GET=2 num-cpus-cgroups
163        # Only 1 CPU
164        docker run --cpus="1" -e NUM_CPUS_TEST_GET=1 num-cpus-cgroups
165        # 1.5 CPUs
166        docker run --cpus="1.5" -e NUM_CPUS_TEST_GET=2 num-cpus-cgroups
167