summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: 89e47930f21728d131a8d60a614024b960e3d485 (plain)
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
105
106
107
name: CI

on:
  schedule:
    - cron: '0 2 * * *' # run at 2 AM UTC
  push:
    branches: [ '*' ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [nightly, stable]
    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.rust == 'nightly' }}

    steps:
    - uses: actions/checkout@v2

    - name: Install Rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        default: true
        profile: minimal
        components: clippy

    - name: Build Debug
      run: |
        rustc --version
        cargo build

    - name: Run tests
      run: make test

    - name: Run clippy
      run: |
        cargo clean
        make clippy

    - name: Build Release
      run: make build-release

  build-linux-musl:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Install Rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        profile: minimal
        target: x86_64-unknown-linux-musl
    - name: Setup MUSL
      run: |
        sudo apt-get -qq install musl-tools
    - name: Build Debug
      run: |
        make build-linux-musl-debug
        ./target/x86_64-unknown-linux-musl/debug/gitui --version
    - name: Build Release
      run: |
        make build-linux-musl-release
        ./target/x86_64-unknown-linux-musl/release/gitui --version
    - name: Test
      run: |
        make test-linux-musl

  rustfmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Install Rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        components: rustfmt
    - run: cargo fmt -- --check

  sec:
    name: Security audit
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/audit-check@v1
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

  log-test:
    name: Changelog Test
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Extract release notes
      id: extract_release_notes
      uses: ffurrer2/extract-release-notes@v1
      with:
        release_notes_file: ./release-notes.txt
    - uses: actions/upload-artifact@v1
      with:
        name: release-notes.txt
        path: ./release-notes.txt