add python tests for failing commands, not just e2e #171
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: Test | |
| on: | |
| push: | |
| # don't run tests for release tags | |
| branches: | |
| - "**" | |
| workflow_call: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - uses: pre-commit/action@v3.0.0 | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: isbang/compose-action@v2.0.1 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install hatch | |
| - name: Setup SSH | |
| run: | | |
| mkdir ~/.ssh | |
| echo 'Host *\nStrictHostKeyChecking no\n' >> ~/.ssh/config | |
| chmod 0700 ~/.ssh | |
| chmod 0600 ~/.ssh/config | |
| chmod 0600 tests/keys/id_ed25519 | |
| - name: Run tests | |
| run: | | |
| hatch run default:cov | |
| - name: Run integration test | |
| run: > | |
| PAGER=less hatch run | |
| shellinspector | |
| --verbose | |
| --target 127.0.0.1:2222 | |
| --identity tests/keys/id_ed25519 | |
| tests/e2e/*.ispec | |
| - name: Check integration test result | |
| run: | | |
| ssh root@127.0.0.1 -p 2222 -i tests/keys/id_ed25519 grep TEST /home/test/testfile | |
| ssh root@127.0.0.1 -p 2222 -i tests/keys/id_ed25519 grep TEST /root/testfile | |
| grep TEST /tmp/testfile |