File: build_and_unit_test.yml

package info (click to toggle)
patch-hub 0.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,616 kB
  • sloc: xml: 142; makefile: 33
file content (52 lines) | stat: -rw-r--r-- 1,239 bytes parent folder | download
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
name: Cargo Build and Unit Test

on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - ready_for_review
      - labeled
    paths:
      - src/**
  push:
    paths:
      - src/**
    branches:
      - master
      - unstable

env:
  CARGO_TERM_COLOR: always

jobs:
  build-and-unit-test:
    runs-on: ubuntu-latest
    timeout-minutes: 2
    if: '!github.event.pull_request.draft'
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha }}

      - name: Update rustup and install rustc and cargo
        shell: bash
        run: |
          rustup update
          rustup install stable

      - name: Check for compilation errors
        shell: bash
        run: |
          cargo build --verbose

      - name: Run unit test suites
        shell: bash
        run: |
          cargo test --all --all-targets --verbose && exit 0
          printf '\e[1;33m\t==========================================\n\e[0m'
          printf '\e[1;33m\tUNIT TEST SUITE FAILED\n\e[0m'
          printf '\e[1;33m\tPLEASE, SOLVE THEM LOCALLY W/ `cargo test`\e[0m\n'
          printf '\e[1;33m\t==========================================\n\e[0m'
          exit 1