From fd4b3ee53972715c6cbec36af48c2e07ace1f5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 24 Oct 2020 13:57:51 +0200 Subject: [PATCH] Move from azure pipelines to GitHub actions for build (#2170) --- .github/workflows/builder.yml | 72 +++++++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 15 -------- azure-pipelines-release.yml | 71 ---------------------------------- 3 files changed, 72 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/builder.yml delete mode 100644 azure-pipelines-release.yml diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml new file mode 100644 index 000000000..88cb34927 --- /dev/null +++ b/.github/workflows/builder.yml @@ -0,0 +1,72 @@ +name: Build supervisor + +on: + pull_request: + branches: ["main"] + release: + types: ["published"] + push: + branches: ["main"] + paths: + - "rootfs/**" + - "supervisor/**" + - build.json + - Dockerfile + - requirements.txt + - setup.py + +env: + BUILD_NAME: supervisor # This needs to match the key in the version file + BUILD_TYPE: supervisor # Can be plugin, core, supervisor or generic + +jobs: + build: + name: Build supervisor + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Get version + id: version + uses: home-assistant/actions/helpers/version@master + with: + type: ${{ env.BUILD_TYPE }} + + - name: Initialize git + if: steps.version.outputs.publish == 'true' + uses: home-assistant/actions/helpers/git-init@master + with: + name: ${{ secrets.GIT_NAME }} + email: ${{ secrets.GIT_EMAIL }} + token: ${{ secrets.GIT_TOKEN }} + + - name: Login to DockerHub + if: steps.version.outputs.publish == 'true' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set build arguments + if: steps.version.outputs.publish == 'false' + run: echo "BUILD_ARGS=--test" >> $GITHUB_ENV + + - name: Build supervisor + uses: home-assistant/builder@2020.10.0 + with: + args: | + $BUILD_ARGS \ + --all \ + --target /data \ + --generic ${{ steps.version.outputs.version }} + + - name: Update version file + if: steps.version.outputs.publish == 'true' + uses: home-assistant/actions/helpers/version-push@master + with: + key: ${{ env.BUILD_NAME }} + version: ${{ steps.version.outputs.version }} + channel: ${{ steps.version.outputs.channel }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c8eb93d2b..579e3a33a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -429,18 +429,3 @@ jobs: coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v1.0.14 - - build: - name: Check build - runs-on: ubuntu-latest - steps: - - name: Check out code from GitHub - uses: actions/checkout@v2 - - name: Build Supervisor - uses: home-assistant/builder@2020.10.0 - with: - args: | - --test \ - --all \ - --target /data \ - --generic ${{ github.sha }} diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml deleted file mode 100644 index a47990031..000000000 --- a/azure-pipelines-release.yml +++ /dev/null @@ -1,71 +0,0 @@ -# https://dev.azure.com/home-assistant - -trigger: - batch: true - branches: - include: - - main - tags: - include: - - "*" - paths: - include: - - supervisor/* - - rootfs/* - - requirements.txt - - setup.py - - Dockerfile - - build.json -pr: none -variables: - - name: versionBuilder - value: "7.2.0" - - group: docker - - group: github -resources: - repositories: - - repository: azure - type: github - name: "home-assistant/ci-azure" - endpoint: "home-assistant" - -stages: - - - stage: "Build" - jobs: - - job: "ReleaseDocker" - timeoutInMinutes: 240 - pool: - vmImage: "ubuntu-latest" - strategy: - maxParallel: 5 - matrix: - amd64: - buildArch: "amd64" - i386: - buildArch: "i386" - armhf: - buildArch: "armhf" - armv7: - buildArch: "armv7" - aarch64: - buildArch: "aarch64" - steps: - - template: templates/azp-step-su-version.yaml@azure - - template: templates/azp-step-build-generic.yaml@azure - parameters: - buildArch: $(buildArch) - buildVersion: $(supervisorRelease) - - - stage: "Publish" - jobs: - - job: "ReleaseHassio" - pool: - vmImage: "ubuntu-latest" - steps: - - template: templates/azp-step-su-version.yaml@azure - - template: templates/azp-step-version-push.yaml@azure - parameters: - jsonTag: supervisor - commitName: Supervisor - buildVersion: $(supervisorRelease)