gitbutler/.github/workflows/push.yaml

155 lines
4.0 KiB
YAML
Raw Normal View History

name: 'Test'
on:
2024-03-26 01:09:51 +03:00
push:
branches:
- master
pull_request:
2023-02-20 15:12:24 +03:00
2024-02-08 18:50:10 +03:00
env:
RUST_BACKTRACE: full
2023-02-20 15:12:24 +03:00
jobs:
2023-09-14 10:16:00 +03:00
changes:
runs-on: ubuntu-latest
outputs:
2023-09-14 10:30:38 +03:00
node: ${{ steps.filter.outputs.node }}
rust: ${{ steps.filter.outputs.rust }}
2023-09-14 10:16:00 +03:00
steps:
2023-09-14 10:21:20 +03:00
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
2023-09-14 10:16:00 +03:00
id: filter
with:
filters: |
workflows: &workflows
- '.github/workflows/**'
- '.github/actions/**'
node:
- *workflows
- 'apps/**'
- 'packages/**'
- 'package.json'
- 'pnpm-lock.yaml'
common-rust: &rust
- *workflows
- 'Cargo.lock'
- 'Cargo.toml'
rust: &any-rust
- *rust
- 'crates/**'
2023-09-14 10:16:00 +03:00
2023-09-14 10:30:38 +03:00
lint-node:
2023-09-14 10:16:00 +03:00
needs: changes
2023-09-14 10:30:38 +03:00
if: ${{ needs.changes.outputs.node == 'true' }}
2023-09-14 09:20:53 +03:00
runs-on: ubuntu-latest
steps:
2023-09-14 09:56:12 +03:00
- uses: actions/checkout@v4
2023-09-14 10:30:38 +03:00
- uses: ./.github/actions/init-env-node
2023-09-14 09:54:23 +03:00
- run: pnpm lint
2023-09-14 09:20:53 +03:00
2023-09-14 10:30:38 +03:00
check-node:
2023-09-14 10:16:00 +03:00
needs: changes
2023-09-14 10:30:38 +03:00
if: ${{ needs.changes.outputs.node == 'true' }}
2023-09-14 09:20:53 +03:00
runs-on: ubuntu-latest
steps:
2023-09-14 09:56:12 +03:00
- uses: actions/checkout@v4
2023-09-14 10:30:38 +03:00
- uses: ./.github/actions/init-env-node
2023-09-14 09:54:23 +03:00
- run: pnpm check
2023-09-14 09:20:53 +03:00
2023-09-14 10:30:38 +03:00
unittest-node:
2023-09-14 10:16:00 +03:00
needs: changes
2023-09-14 10:30:38 +03:00
if: ${{ needs.changes.outputs.node == 'true' }}
2023-09-14 09:20:53 +03:00
runs-on: ubuntu-latest
steps:
2023-09-14 09:56:12 +03:00
- uses: actions/checkout@v4
2023-09-14 10:30:38 +03:00
- uses: ./.github/actions/init-env-node
2023-09-14 09:54:23 +03:00
- run: pnpm test
2023-09-14 09:20:53 +03:00
2024-05-02 13:52:44 +03:00
rust-lint:
2023-09-14 10:16:00 +03:00
needs: changes
2023-09-14 10:30:38 +03:00
if: ${{ needs.changes.outputs.rust == 'true' }}
2023-09-14 10:16:00 +03:00
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
2024-08-06 13:08:49 +03:00
env:
CARGO_TERM_COLOR: always
2023-09-14 10:16:00 +03:00
steps:
- uses: actions/checkout@v4
- run: cargo fmt --check --all
- run: cargo check --workspace --all-targets
2023-09-14 09:20:53 +03:00
2024-01-25 21:49:18 +03:00
rust-docs:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
2024-08-06 13:08:49 +03:00
env:
CARGO_TERM_COLOR: always
2024-01-25 21:49:18 +03:00
steps:
- uses: actions/checkout@v4
# TODO(qix-): we have to exclude the app here for now because for some
# TODO(qix-): reason it doesn't build with the docs feature enabled.
2024-05-07 08:03:34 +03:00
- run: cargo doc --no-deps --all-features --document-private-items -p gitbutler-git
2024-01-25 21:49:18 +03:00
env:
RUSTDOCFLAGS: -Dwarnings
2024-07-08 12:31:49 +03:00
rust-test:
2024-05-02 13:52:44 +03:00
needs: changes
2024-07-08 12:31:49 +03:00
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
2024-08-06 13:08:49 +03:00
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
2024-07-08 12:31:49 +03:00
# Specifies which features should be applied when running the checks and tests
# '' indicates no flags relating to features passed
# [] indicates --no-default-features flag passed
# '*' indicates --all-features passed
# [entry1, entry2] indicates --features entry1 entry2
features:
- ''
- '*'
- []
- [tokio]
2024-07-08 12:31:49 +03:00
- [devtools]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/check-crate
with:
2024-05-06 22:15:56 +03:00
features: ${{ toJson(matrix.features) }}
check-rust:
if: always()
needs:
- changes
- check-rust-windows
2024-07-08 12:31:49 +03:00
- rust-test
2024-05-02 13:52:44 +03:00
- rust-lint
runs-on: ubuntu-latest
2024-08-06 13:08:49 +03:00
env:
CARGO_TERM_COLOR: always
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
check-rust-windows:
needs: changes
runs-on: windows-latest
if: ${{ needs.changes.outputs.rust == 'true' }}
2024-08-06 13:08:49 +03:00
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
2024-07-08 21:15:29 +03:00
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
with:
2024-07-09 13:35:23 +03:00
shared-key: windows-rust-testing
2024-07-08 21:15:29 +03:00
key: ${{ inputs.features }}
- name: 'cargo check'
run: cargo check --workspace --all-targets --features windows