gitui/.github/workflows/ci.yml

238 lines
6.1 KiB
YAML
Raw Normal View History

2020-03-23 16:59:46 +03:00
name: CI
2020-03-23 16:53:38 +03:00
on:
2020-03-23 20:39:16 +03:00
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
2020-03-23 16:53:38 +03:00
push:
2020-03-30 20:07:08 +03:00
branches: [ '*' ]
2020-03-23 16:53:38 +03:00
pull_request:
branches: [ master ]
2021-04-22 23:12:38 +03:00
env:
CARGO_TERM_COLOR: always
2020-03-23 16:53:38 +03:00
jobs:
build:
2020-03-23 20:33:24 +03:00
strategy:
2020-08-17 22:02:11 +03:00
fail-fast: false
2020-03-23 20:33:24 +03:00
matrix:
2020-07-21 10:24:28 +03:00
os: [ubuntu-latest, macos-latest, windows-latest]
2023-01-28 16:52:54 +03:00
rust: [nightly, stable, '1.64']
2020-03-23 20:33:24 +03:00
runs-on: ${{ matrix.os }}
2020-08-28 11:52:24 +03:00
continue-on-error: ${{ matrix.rust == 'nightly' }}
2020-03-23 20:39:16 +03:00
2020-03-23 16:53:38 +03:00
steps:
2020-03-27 02:27:07 +03:00
- uses: actions/checkout@v2
2020-06-06 20:24:48 +03:00
2020-11-07 23:39:57 +03:00
- name: Restore cargo cache
uses: actions/cache@v2
env:
2020-11-07 23:49:02 +03:00
cache-name: ci
2020-11-07 23:39:57 +03:00
with:
2020-11-07 23:49:02 +03:00
path: |
~/.cargo/registry
~/.cargo/git
2020-11-08 01:47:03 +03:00
~/.cargo/bin
2020-11-07 23:49:02 +03:00
target
key: ${{ matrix.os }}-${{ env.cache-name }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }}
2020-11-07 23:39:57 +03:00
2020-11-08 02:02:11 +03:00
- name: MacOS Workaround
if: matrix.os == 'macos-latest'
run: cargo clean -p serde_derive -p thiserror
2020-11-08 02:02:11 +03:00
2020-06-06 20:24:48 +03:00
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
2020-08-28 11:52:24 +03:00
toolchain: ${{ matrix.rust }}
default: true
override: true
2020-06-06 20:24:48 +03:00
profile: minimal
components: clippy
2020-04-15 17:36:40 +03:00
- name: Build Debug
2020-06-06 20:24:48 +03:00
run: |
cargo build
2020-03-23 16:53:38 +03:00
- name: Run tests
2020-04-13 11:23:55 +03:00
run: make test
2020-06-06 20:24:48 +03:00
2020-03-27 02:16:57 +03:00
- name: Run clippy
run: |
make clippy
2020-07-21 10:24:28 +03:00
2020-04-15 17:36:40 +03:00
- name: Build Release
run: make build-release
2020-04-05 16:29:41 +03:00
- name: Test Install
2023-03-03 17:43:32 +03:00
run: cargo install --path "." --force
2021-04-19 19:20:21 +03:00
- name: Binary Size (unix)
if: matrix.os != 'windows-latest'
2021-04-19 19:16:59 +03:00
run: |
ls -l ./target/release/gitui
2021-04-19 19:20:21 +03:00
- name: Binary Size (win)
if: matrix.os == 'windows-latest'
run: |
ls -l ./target/release/gitui.exe
2021-04-19 19:16:59 +03:00
- name: Binary dependencies (mac)
if: matrix.os == 'macos-latest'
run: |
otool -L ./target/release/gitui
2020-10-26 04:11:37 +03:00
- name: Build MSI (windows)
2020-10-26 03:18:04 +03:00
if: matrix.os == 'windows-latest'
2020-10-26 04:11:37 +03:00
run: |
cargo install cargo-wix --version 0.3.3
2022-01-17 15:08:55 +03:00
cargo wix --version
cargo wix -p gitui --no-build --nocapture --output ./target/wix/gitui.msi
ls -l ./target/wix/gitui.msi
2020-10-26 03:18:04 +03:00
build-linux-musl:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
2023-01-28 16:52:54 +03:00
rust: [nightly, stable, '1.64']
continue-on-error: ${{ matrix.rust == 'nightly' }}
steps:
- uses: actions/checkout@master
2020-06-06 20:24:48 +03:00
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
2020-06-06 20:24:48 +03:00
profile: minimal
default: true
override: true
2020-06-06 20:24:48 +03:00
target: x86_64-unknown-linux-musl
2021-04-20 01:23:07 +03:00
- 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
2021-04-19 19:16:59 +03:00
ls -l ./target/x86_64-unknown-linux-musl/release/gitui
- name: Test
run: |
make test-linux-musl
- name: Test Install
2023-03-03 17:43:32 +03:00
run: cargo install --path "." --force
build-linux-arm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
2023-01-28 16:52:54 +03:00
rust: [nightly, stable, '1.64']
continue-on-error: ${{ matrix.rust == 'nightly' }}
steps:
- uses: actions/checkout@master
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
default: true
override: true
- name: Setup ARM toolchain
run: |
rustup target add aarch64-unknown-linux-gnu
rustup target add armv7-unknown-linux-gnueabihf
rustup target add arm-unknown-linux-gnueabihf
curl -o $GITHUB_WORKSPACE/aarch64.tar.xz https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/8.2-2018.08/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu.tar.xz
curl -o $GITHUB_WORKSPACE/arm.tar.xz https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/8.2-2018.08/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf.tar.xz
tar xf $GITHUB_WORKSPACE/aarch64.tar.xz
tar xf $GITHUB_WORKSPACE/arm.tar.xz
echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin" >> $GITHUB_PATH
- name: Build Debug
run: |
make build-linux-arm-debug
- name: Build Release
run: |
make build-linux-arm-release
ls -l ./target/aarch64-unknown-linux-gnu/release/gitui || ls -l ./target/armv7-unknown-linux-gnueabihf/release/gitui || ls -l ./target/arm-unknown-linux-gnueabihf/release/gitui
linting:
name: Lints
2020-04-05 16:29:41 +03:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
2020-06-06 20:24:48 +03:00
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
2020-06-06 20:24:48 +03:00
components: rustfmt
- run: cargo fmt -- --check
2021-11-28 15:41:42 +03:00
- name: cargo-sort
run: |
cargo install cargo-sort --force
cargo sort -c -w
- name: cargo-deny install
run: |
cargo install --locked cargo-deny
- name: cargo-deny licenses
run: |
cargo deny check licenses
- name: cargo-deny bans
run: |
cargo deny check bans
2023-02-05 12:32:25 +03:00
udeps:
name: udeps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: cargo-udeps
run: |
cargo install --locked cargo-udeps
cargo +nightly udeps --all-targets
2021-11-24 15:53:21 +03:00
sec:
name: Security audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
2020-05-13 19:15:17 +03:00
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:
2020-06-06 20:44:57 +03:00
name: release-notes.txt
path: ./release-notes.txt