Support develop workflow and "next" tag #207
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: CI Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| tags: [ "*.*.*" ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| permissions: | |
| packages: write | |
| contents: read | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install pipenv | |
| pipenv install --dev | |
| - name: Run tests | |
| run: pipenv run python3 -m pytest --junitxml=test-results.xml | |
| - name: Validate Python code with flake8 | |
| run: pipenv run python3 -m flake8 --select BLK **/*.py | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.python-version }} | |
| path: test-results.xml | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - platform: linux/amd64 | |
| base: distroless | |
| - platform: linux/arm/v6 | |
| base: alpine | |
| - platform: linux/arm/v7 | |
| base: alpine | |
| - platform: linux/arm64 | |
| base: distroless | |
| uses: ./.github/workflows/build-image.yml | |
| with: | |
| registry: ghcr.io | |
| platform: ${{ matrix.config.platform }} | |
| base: ${{ matrix.config.base }} | |
| context: . | |
| dockerfile: ./Dockerfile | |
| image-suffix: "" | |
| digest-prefix: "digests-base-" | |
| push: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} | |
| merge: | |
| needs: [build] | |
| if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
| uses: ./.github/workflows/merge-manifests.yml | |
| with: | |
| registry: ghcr.io | |
| image-suffix: "" | |
| digest-prefix: "digests-base-" | |
| build-addon: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - linux/amd64 | |
| - linux/arm64 | |
| - linux/arm/v7 | |
| - linux/arm/v6 | |
| uses: ./.github/workflows/build-image.yml | |
| with: | |
| registry: ghcr.io | |
| platform: ${{ matrix.platform }} | |
| context: . | |
| dockerfile: ./ha_addon/Dockerfile | |
| build-args: | | |
| BUILD_FROM=ghcr.io/hassio-addons/base:14.2.2 | |
| image-suffix: "-addon" | |
| digest-prefix: "digests-addon-" | |
| push: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} | |
| merge-addon: | |
| needs: [build-addon] | |
| if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
| uses: ./.github/workflows/merge-manifests.yml | |
| with: | |
| registry: ghcr.io | |
| image-suffix: "-addon" | |
| digest-prefix: "digests-addon-" |