Skip to content

Commit

Permalink
[ci] Consolidate workflows #1420 (#1483)
Browse files Browse the repository at this point in the history
* consolidate workflows

* fixes

* Update examples.yaml
  • Loading branch information
michaelvlach authored Jan 12, 2025
1 parent d216c59 commit 317cf52
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 453 deletions.
50 changes: 11 additions & 39 deletions .github/workflows/agdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,27 @@ name: agdb
on:
pull_request:
branches: ["main"]
paths:
- agdb/**
- agdb_derive/**
- .github/workflows/agdb.yaml

jobs:
diff:
agdb:
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.diff.outputs.diff }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diff
shell: bash
run: |
if [[ "$(git diff origin/main --name-only -- agdb/ agdb_derive/ .github/workflows/agdb.yaml)" != "" ]]; then (echo "diff=true" >> $GITHUB_OUTPUT); fi
agdb_analyse:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo clippy --package agdb --package agdb_derive --all-targets --all-features -- -D warnings

agdb_coverage:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt -p agdb --check
- run: cargo clippy -p agdb --all-targets --all-features -- -D warnings
- uses: taiki-e/install-action@cargo-llvm-cov
- run: rustup component add llvm-tools-preview
- run: cargo llvm-cov --package agdb --package agdb_derive --all-features --ignore-filename-regex "agdb_derive" --fail-uncovered-functions 27 --show-missing-lines

agdb_doctest:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --package agdb --package agdb_derive --all-features --doc
- run: cargo llvm-cov -p agdb --all-features --ignore-filename-regex "agdb_derive" --fail-uncovered-functions 27 --fail-uncovered-lines 127 --show-missing-lines

agdb_format:
# merge with the main job once --doctests is stabilized: https://github.com/taiki-e/cargo-llvm-cov/issues/2
agdb_doctests:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt --package agdb --package agdb_derive --check
- run: cargo test -p agdb --all-features --doc
51 changes: 12 additions & 39 deletions .github/workflows/agdb_api_php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,29 @@ name: agdb_api_php
on:
pull_request:
branches: ["main"]
paths:
- composer.json
- agdb_api/php/**
- .github/workflows/agdb_api_php.yaml

jobs:
diff:
runs-on: ubuntu-24.04
outputs:
diff: ${{ steps.diff.outputs.diff }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diff
shell: bash
run: |
if [[ "$(git diff origin/main --name-only -- composer.json agdb_api/php/ .github/workflows/agdb_api_php.yaml)" != "" ]]; then (echo "diff=true" >> $GITHUB_OUTPUT); fi
agdb_api_php_analyse:
runs-on: ubuntu-24.04
needs: diff
if: needs.diff.outputs.diff == 'true'
agdb_api_php:
runs-on: ubuntu-latest
defaults:
run:
working-directory: agdb_api/php
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: ./ci.sh format:check
- run: composer config --global use-parent-dir true
- run: composer install
- run: ./ci.sh analyse
working-directory: agdb_api/php

agdb_api_php_coverage:
runs-on: ubuntu-24.04
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: composer install
- run: ./ci.sh coverage
working-directory: agdb_api/php
- uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: agdb_api/php/coverage/
retention-days: 30

agdb_api_php_format:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
defaults:
run:
working-directory: agdb_api/php
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: ./ci.sh format:check
57 changes: 0 additions & 57 deletions .github/workflows/agdb_api_rust.yaml

This file was deleted.

44 changes: 5 additions & 39 deletions .github/workflows/agdb_api_typescript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,26 @@ name: agdb_api_typescript
on:
pull_request:
branches: ["main"]
paths:
- agdb_api/typescript/**
- .github/workflows/agdb_api_typescript.yaml

jobs:
diff:
agdb_api_typescript:
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.diff.outputs.diff }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diff
shell: bash
run: |
if [[ "$(git diff origin/main --name-only -- agdb_api/typescript/ .github/workflows/agdb_api_typescript.yaml)" != "" ]]; then (echo "diff=true" >> $GITHUB_OUTPUT); fi
agdb_api_typescript_analyse:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
defaults:
run:
working-directory: agdb_api/typescript
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run format:check
- run: npm run lint:check

agdb_api_typescript_coverage:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
defaults:
run:
working-directory: agdb_api/typescript
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: npm ci
- run: npm run test
- uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: agdb_api/typescript/coverage/
retention-days: 30

agdb_api_typescript_format:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
defaults:
run:
working-directory: agdb_api/typescript
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run format:check
42 changes: 8 additions & 34 deletions .github/workflows/agdb_benchmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,18 @@ name: agdb_benchmarks
on:
pull_request:
branches: ["main"]
paths:
- agdb_benchmarks/**
- agdb/**
- agdb_derive/**
- .github/workflows/agdb_benchmarks.yaml

jobs:
diff:
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.diff.outputs.diff }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diff
shell: bash
run: |
if [[ "$(git diff origin/main --name-only -- agdb_benchmarks/ agdb/src/ agdb/src/Cargo.toml agdb_derive/src/ agdb_derive/Cargo.toml .github/workflows/agdb_benchmarks.yaml)" != "" ]]; then (echo "diff=true" >> $GITHUB_OUTPUT); fi
agdb_benchmarks:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo run --release --package agdb_benchmarks

agdb_benchmarks_analyse:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo clippy --package agdb_benchmarks --all-targets --all-features -- -D warnings

agdb_benchmarks_format:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt --package agdb_benchmarks --check
- run: cargo fmt -p agdb_benchmarks --check
- run: cargo clippy -p agdb_benchmarks --all-targets --all-features -- -D warnings
- run: cargo run -p agdb_benchmarks -r
50 changes: 14 additions & 36 deletions .github/workflows/agdb_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,26 @@ name: agdb_ci
on:
pull_request:
branches: ["main"]
paths:
- agdb_ci/**
- Version
- .github/workflows/agdb_ci.yaml

jobs:
diff:
agdb_ci:
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.diff.outputs.diff }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diff
shell: bash
run: |
if [[ "$(git diff origin/main --name-only -- agdb_ci/ .github/workflows/agdb_ci.yaml Version)" != "" ]]; then (echo "diff=true" >> $GITHUB_OUTPUT); fi
agdb_ci_analyse:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo clippy --package agdb_ci --all-targets --all-features -- -D warnings

agdb_ci_format:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt --package agdb_ci --check

validate_version:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt -p agdb_ci --check
- run: cargo clippy -p agdb_ci --all-targets --all-features -- -D warnings
- run: cargo run -p agdb_ci -r
- run: |
cargo run --release --package agdb_ci
if [[ "$(git diff --name-only)" != "" ]]; then git diff; git diff --name-only; echo "ERROR: Some packages have not been updated. Have you forgotten to run agdb_ci?"; exit 1; fi
if [[ "$(git diff --name-only)" != "" ]]; then
git diff
git diff --name-only
echo "ERROR: Some packages have not been updated. Plesae run 'cargo run -p agdb_ci -r' and commit the result."
exit 1
fi
Loading

0 comments on commit 317cf52

Please sign in to comment.