feat: add generator test to CI #533
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: tests | |
| on: | |
| pull_request: | |
| branches: | |
| - "*" | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "*" | |
| workflow_dispatch: {} | |
| jobs: | |
| verify-generated-code: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: install rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: install kopium | |
| run: cargo install kopium --version 0.22.5 | |
| - name: run make generate | |
| run: make generate | |
| - name: verify no changes | |
| run: | | |
| if ! git diff --exit-code; then | |
| echo "Error: Generated code is not up to date. Please run 'make generate' and commit the changes." | |
| exit 1 | |
| fi | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| needs: verify-generated-code | |
| steps: | |
| - name: checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: install rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: run unit tests | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: -v -- --nocapture | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| needs: [verify-generated-code, unit-tests] | |
| steps: | |
| - name: checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: install rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: run integration tests | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: -v -- --nocapture --ignored |