gitbutler/.github/workflows/push.yaml
2024-07-08 00:28:47 +02:00

408 lines
11 KiB
YAML

name: "Test"
on:
push:
branches:
- master
pull_request:
env:
RUST_BACKTRACE: full
jobs:
changes:
runs-on: ubuntu-latest
outputs:
node: ${{ steps.filter.outputs.node }}
rust: ${{ steps.filter.outputs.rust }}
gitbutler-core: ${{ steps.filter.outputs.gitbutler-core }}
gitbutler-tauri: ${{ steps.filter.outputs.gitbutler-tauri }}
gitbutler-git: ${{ steps.filter.outputs.gitbutler-git }}
gitbutler-cli: ${{ steps.filter.outputs.gitbutler-cli }}
gitbutler-watcher: ${{ steps.filter.outputs.gitbutler-watcher }}
gitbutler-branch: ${{ steps.filter.outputs.gitbutler-branch }}
gitbutler-sync: ${{ steps.filter.outputs.gitbutler-sync }}
gitbutler-oplog: ${{ steps.filter.outputs.gitbutler-oplog }}
gitbutler-branchstate: ${{ steps.filter.outputs.gitbutler-branchstate }}
gitbutler-repo: ${{ steps.filter.outputs.gitbutler-repo }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
workflows: &workflows
- '.github/workflows/**'
- '.github/actions/**'
node:
- *workflows
- 'app/**'
- 'package.json'
- 'pnpm-lock.yaml'
common-rust: &rust
- *workflows
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain.toml'
rust: &any-rust
- *rust
- 'crates/**'
gitbutler-tauri:
- *any-rust
gitbutler-core:
- *rust
- 'crates/gitbutler-core/**'
gitbutler-git:
- *rust
- 'crates/gitbutler-git/**'
gitbutler-cli:
- *rust
- 'crates/gitbutler-cli/**'
gitbutler-watcher:
- *rust
- 'crates/gitbutler-watcher/**'
gitbutler-branch:
- *rust
- 'crates/gitbutler-branch/**'
gitbutler-sync:
- *rust
- 'crates/gitbutler-sync/**'
gitbutler-oplog:
- *rust
- 'crates/gitbutler-oplog/**'
gitbutler-branchstate:
- *rust
- 'crates/gitbutler-branchstate/**'
gitbutler-repo:
- *rust
- 'crates/gitbutler-repo/**'
lint-node:
needs: changes
if: ${{ needs.changes.outputs.node == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-node
- run: pnpm lint
check-node:
needs: changes
if: ${{ needs.changes.outputs.node == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-node
- run: pnpm check
unittest-node:
needs: changes
if: ${{ needs.changes.outputs.node == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-node
- run: pnpm test
rust-lint:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- run: cargo fmt --check --all
rust-docs:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
# 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.
- run: cargo doc --no-deps --all-features --document-private-items -p gitbutler-git
env:
RUSTDOCFLAGS: -Dwarnings
check-gitbutler-tauri:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-tauri == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
- check-tests
features:
- ''
- [devtools]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-tauri
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-git:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-git == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
features:
- ''
- '*'
- []
- [tokio]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-git
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-core:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-core == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-core
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-branch:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-branch == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-branch
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-sync:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-sync == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-sync
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-oplog:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-oplog == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-oplog
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-branchstate:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-branchstate == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-branchstate
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-repo:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-repo == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-repo
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-cli:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-cli == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
- check-tests
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-cli
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-gitbutler-watcher:
needs: changes
if: ${{ needs.changes.outputs.gitbutler-watcher == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
strategy:
matrix:
action:
- test
- check
- check-tests
features:
- ''
- '*'
- []
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-rust
- uses: ./.github/actions/check-crate
with:
crate: gitbutler-notify-debouncer
features: ${{ toJson(matrix.features) }}
action: ${{ matrix.action }}
check-rust:
if: always()
needs:
- changes
- check-gitbutler-tauri
- check-gitbutler-core
- check-gitbutler-branch
- check-gitbutler-sync
- check-gitbutler-oplog
- check-gitbutler-branchstate
- check-gitbutler-repo
- check-gitbutler-git
- check-gitbutler-cli
- check-gitbutler-watcher
- check-rust-windows
- rust-lint
runs-on: ubuntu-latest
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' }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init-env-rust
- name: "cargo check"
run: cargo check --all --bins --examples --features windows