Skip to content

editoast: add some doc about batch updating dependencies #5861

editoast: add some doc about batch updating dependencies

editoast: add some doc about batch updating dependencies #5861

Workflow file for this run

name: Test Editoast
on:
workflow_dispatch:
pull_request:
paths:
- editoast/**
- .github/workflows/editoast.yml
merge_group:
# TODO: paths may not be relvant for merge_group
# https://docs.github.com/en/webhooks/webhook-events-and-payloads#merge_group
paths:
- editoast/**
- .github/workflows/editoast.yml
push:
branches:
- dev
- staging
- prod
jobs:
editoast_openapi:
name: Check openapi.yaml sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# run the CI on the actual latest commit of the PR, not the attempted merge
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lib posgresql & geos
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev libgeos-dev
- name: Setup toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Load cached target
uses: actions/cache@v3
id: cached-cargo-dependencies
with:
path: editoast/target/
key: osrd-editoast-openapi-target-${{ hashFiles('editoast/Cargo.lock') }}
- name: Check openapi.yaml sync
run: diff <(cargo run --release --manifest-path editoast/Cargo.toml -- openapi) editoast/openapi.yaml
editoast_tests:
name: Tests editoast and check coverage
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
# run the CI on the actual latest commit of the PR, not the attempted merge
ref: ${{ github.event.pull_request.head.sha }}
- name: Init database
run: psql postgresql://postgres:password@localhost -f ./docker/init_db.sql
- name: Install lib posgresql & geos
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev libgeos-dev
- name: Install diesel-cli
run: cargo install diesel_cli --no-default-features --features postgres
- name: Apply migrations
run: diesel migration run --locked-schema
working-directory: ./editoast
env:
DATABASE_URL: postgres://osrd:password@localhost:5432/osrd
- name: Setup rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Load cached target
uses: actions/cache@v3
id: cached-cargo-dependencies
with:
path: editoast/target/
key: osrd-editoast-target-tests-${{ hashFiles('editoast/Cargo.lock') }}
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Test and coverage
run: cargo tarpaulin -r ./editoast -p editoast -p editoast_derive --out xml -- --test-threads 1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
# github runs PR workflows on the result of a merge commit.
# tell codecov the sha of the unmerged PR https://github.com/codecov/uploader/issues/525
override_commit: "${{ github.event.pull_request.head.sha }}"
name: codecov
flags: editoast
files: cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
editoast_linter:
name: Check format and run linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# run the CI on the actual latest commit of the PR, not the attempted merge
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lib posgresql & geos
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev libgeos-dev
- name: Setup toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Load cached target
uses: actions/cache@v3
id: cached-cargo-dependencies
with:
path: editoast/target/
key: osrd-editoast-target-linter-${{ hashFiles('editoast/Cargo.lock') }}
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path editoast/Cargo.toml --check
- name: Clippy linter
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets --manifest-path=editoast/Cargo.toml -- -D warnings
- name: Documentation check
run: cargo doc --manifest-path editoast/Cargo.toml
env:
RUSTDOCFLAGS: "-D warnings" # Set warnings as errors