|
| 1 | +name: Code quality - CDK constructor |
| 2 | + |
| 3 | +# PROCESS |
| 4 | +# |
| 5 | +# 1. Install all dependencies and spin off containers for all supported Python versions |
| 6 | +# 2. Run code formatters and linters (various checks) for code standard |
| 7 | +# 3. Run static typing checker for potential bugs |
| 8 | +# 4. Run tests |
| 9 | + |
| 10 | +# USAGE |
| 11 | +# |
| 12 | +# Always triggered on new PRs, PR changes and PR merge. |
| 13 | + |
| 14 | + |
| 15 | +on: |
| 16 | + pull_request: |
| 17 | + paths: |
| 18 | + - "layer/layer_constructors/**" |
| 19 | + branches: |
| 20 | + - develop |
| 21 | + push: |
| 22 | + paths: |
| 23 | + - "layer/layer_constructors/**" |
| 24 | + branches: |
| 25 | + - develop |
| 26 | + |
| 27 | +permissions: |
| 28 | + contents: read |
| 29 | + |
| 30 | +jobs: |
| 31 | + quality_check: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + strategy: |
| 34 | + max-parallel: 4 |
| 35 | + matrix: |
| 36 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 37 | + env: |
| 38 | + PYTHON: "${{ matrix.python-version }}" |
| 39 | + permissions: |
| 40 | + contents: read # checkout code only |
| 41 | + defaults: |
| 42 | + run: |
| 43 | + working-directory: ./layer_v3/layer_constructors |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 |
| 46 | + - name: Install poetry |
| 47 | + run: pipx install poetry |
| 48 | + - name: Set up Python ${{ matrix.python-version }} |
| 49 | + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 |
| 50 | + with: |
| 51 | + python-version: ${{ matrix.python-version }} |
| 52 | + cache: "poetry" |
| 53 | + - name: Set up QEMU |
| 54 | + uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.0.0 |
| 55 | + with: |
| 56 | + platforms: arm64 |
| 57 | + # NOTE: we need QEMU to build Layer against a different architecture (e.g., ARM) |
| 58 | + - name: Set up Docker Buildx |
| 59 | + id: builder |
| 60 | + uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1 |
| 61 | + with: |
| 62 | + install: true |
| 63 | + driver: docker |
| 64 | + platforms: linux/amd64,linux/arm64 |
| 65 | + - name: Install dependencies |
| 66 | + run: | |
| 67 | + pip install --upgrade pip pre-commit poetry |
| 68 | + poetry install |
| 69 | + - name: Test with pytest |
| 70 | + run: poetry run pytest tests |
0 commit comments