Continuous integration #80
This file contains 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: Continuous integration | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 7 * * 6" | |
jobs: | |
yamllint: | |
name: Yaml lint | |
uses: x-real-ip/github-actions/.github/workflows/yamllint.yaml@main | |
test_latest: | |
name: Test config with latest image | |
runs-on: ubuntu-latest | |
container: | |
image: esphome/esphome:latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Prepare secrets file | |
run: mv ./src/config/secrets.yaml.example ./src/config/secrets.yaml | |
- name: Test esp configs with latest | |
run: | | |
cd ./src/ | |
for file in $(find config -maxdepth 1 -type f -name "*.yaml" -not -name "secrets.yaml"); do | |
esphome config "$file" | |
done | |
for file in $(find ./src/config -maxdepth 1 -type f -name "*.yaml" -not -name "secrets.yaml"); do | |
esphome config "$file" | |
done | |
test_beta: | |
name: Test config with beta image | |
runs-on: ubuntu-latest | |
container: | |
image: esphome/esphome:beta | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Prepare secrets file | |
run: mv ./src/config/secrets.yaml.example ./src/config/secrets.yaml | |
- name: Test esp configs with beta | |
continue-on-error: false | |
run: | | |
cd ./src/ | |
for file in $(find config -maxdepth 1 -type f -name "*.yaml" -not -name "secrets.yaml"); do | |
esphome config "$file" | |
done | |
for file in $(find ./src/config -maxdepth 1 -type f -name "*.yaml" -not -name "secrets.yaml"); do | |
esphome config "$file" | |
done | |
build-and-push-image: | |
name: Build and Push Image | |
needs: [yamllint, test_latest, test_beta] | |
uses: x-real-ip/github-actions/.github/workflows/build-and-push.yaml@main | |
with: | |
publish: true | |
dispatch-update-manifest: | |
name: Repository Dispatch to Update Manifest | |
needs: [build-and-push-image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
repository: x-real-ip/gitops | |
event-type: update-manifest | |
client-payload: | |
'{"ref": "${{ github.ref }}", "repository": "${{ | |
github.repository}}", "registry": "ghcr.io", "sha": "${{ github.sha | |
}}"}' |