From 5ec9a6da923735f38fc8ef24485b58018cec91f7 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 16 Feb 2023 17:33:23 -0800 Subject: [PATCH] Update automation to shared repository (#367) --- .github/workflows/license_tests.yml | 34 +------ .github/workflows/publish_release.yml | 81 ++-------------- .github/workflows/publish_test_build.yml | 111 ++-------------------- .github/workflows/pull_master.yml | 15 +-- .github/workflows/unit_tests.yml | 21 ++-- .github/workflows/update_skills_image.yml | 44 ++------- 6 files changed, 38 insertions(+), 268 deletions(-) diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index acaf981c4..a284db6bc 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -5,36 +5,4 @@ on: jobs: license_tests: - timeout-minutes: 15 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev libfann-dev portaudio19-dev libpulse-dev - - name: Install core repo - run: | - pip install .[pi,docker] - - name: Get explicit and transitive dependencies - run: | - pip freeze > requirements-all.txt - - name: Check python - id: license_check_report - uses: pilosus/action-pip-license-checker@v0.5.0 - with: - requirements: 'requirements-all.txt' - fail: 'Copyleft,Other,Error' - fails-only: true - exclude: '^(precise-runner|fann2|tqdm|bs4|ovos-phal-plugin|ovos-skill|neon-core|nvidia|neon-phal-plugin).*' - exclude-license: '^(Mozilla|NeonAI License v1.0).*$' - - name: Print report - if: ${{ always() }} - run: echo "${{ steps.license_check_report.outputs.report }}" \ No newline at end of file + uses: neongeckocom/.github/.github/workflows/license_tests.yml@master diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 3ea96e45b..e34a096bc 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -6,76 +6,15 @@ on: branches: - master -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository_owner }}/neon_skills - jobs: - tag_release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Get Version - run: | - VERSION=$(python setup.py --version) - echo "VERSION=${VERSION}" >> $GITHUB_ENV - - uses: ncipollo/release-action@v1 - with: - token: ${{secrets.GITHUB_TOKEN}} - tag: ${{env.VERSION}} + build_and_publish_pypi_and_release: + uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master + secrets: inherit build_and_publish_docker: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - name: Get Version - id: version - run: | - VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version)) - echo ::set-output name=version::${VERSION} - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for base Docker - id: base_meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} - type=ref,event=branch - - name: Build and push base Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.base_meta.outputs.tags }} - labels: ${{ steps.base_meta.outputs.labels }} - target: base - - - name: Extract metadata for default_skills Docker - id: default_skills_meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-default_skills - tags: | - type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} - type=ref,event=branch - - name: Build and push default_skills Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.default_skills_meta.outputs.tags }} - labels: ${{ steps.default_skills_meta.outputs.labels }} - target: default_skills + needs: build_and_publish_pypi_and_release + uses: neongeckocom/.github/.github/workflows/publish_docker.yml@master + secrets: inherit + with: + image_name: ${{ github.repository_owner }}/neon_skills + base_tag: base + extra_tag: default_skills diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index a0411836c..84b3042db 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -8,106 +8,15 @@ on: paths-ignore: - 'version.py' -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository_owner }}/neon_skills - jobs: - increment_version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Increment Version - run: | - VER=$(python setup.py --version) - python version_bump.py - - name: Push Version Change - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Increment Version - tag_alpha_release: - runs-on: ubuntu-latest - needs: increment_version - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - name: Get Version - id: version - run: | - VERSION=$(python setup.py --version) - echo ::set-output name=version::${VERSION} - - name: Create Pre-release - uses: ncipollo/release-action@v1 - with: - token: ${{secrets.GITHUB_TOKEN}} - tag: ${{steps.version.outputs.version}} - commit: ${{ github.ref }} - prerelease: true + build_and_publish_pypi: + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + secrets: inherit build_and_publish_docker: - runs-on: ubuntu-latest - needs: increment_version - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - name: Get Version - id: version - run: | - VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version)) - echo ::set-output name=version::${VERSION} - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for base Docker - id: base_meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} - type=ref,event=branch - - name: Build and push base Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.base_meta.outputs.tags }} - labels: ${{ steps.base_meta.outputs.labels }} - target: base - - - name: Extract metadata for default_skills Docker - id: default_skills_meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-default_skills - tags: | - type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} - type=ref,event=branch - - name: Build and push default_skills Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.default_skills_meta.outputs.tags }} - labels: ${{ steps.default_skills_meta.outputs.labels }} - target: default_skills \ No newline at end of file + needs: build_and_publish_pypi + uses: neongeckocom/.github/.github/workflows/publish_docker.yml@master + secrets: inherit + with: + image_name: ${{ github.repository_owner }}/neon_skills + base_tag: base + extra_tag: default_skills diff --git a/.github/workflows/pull_master.yml b/.github/workflows/pull_master.yml index 8e9c5a87f..8ab60d36b 100644 --- a/.github/workflows/pull_master.yml +++ b/.github/workflows/pull_master.yml @@ -5,17 +5,10 @@ on: push: branches: - dev - workflow_dispatch: jobs: pull_changes: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: pull-request-action - uses: repo-sync/pull-request@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - pr_reviewer: 'neonreviewers' - pr_assignee: 'neondaniel' - pr_draft: true \ No newline at end of file + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + with: + pr_reviewer: neonreviewers + pr_assignee: neondaniel diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 531ade191..d7a81ca88 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -5,22 +5,13 @@ on: push: workflow_dispatch: -# TODO: Run tests here for everything in NeonCore jobs: - build_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Build Distribution Packages - run: | - python setup.py bdist_wheel + py_build_tests: + uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master + with: + python_version: "3.8" + docker_build_tests: + uses: neongeckocom/.github/.github/workflows/docker_build_tests.yml@master util_tests: strategy: matrix: diff --git a/.github/workflows/update_skills_image.yml b/.github/workflows/update_skills_image.yml index 4b8330db8..d9ebb33ef 100644 --- a/.github/workflows/update_skills_image.yml +++ b/.github/workflows/update_skills_image.yml @@ -2,41 +2,11 @@ name: Update Skills Image on: workflow_dispatch: -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository_owner }}/neon_skills - jobs: - update_default_skills_image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for default_skills Docker - id: default_skills_meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-default_skills - tags: | - type=ref,event=branch - - name: Build and push default_skills Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.default_skills_meta.outputs.tags }} - labels: ${{ steps.default_skills_meta.outputs.labels }} - target: default_skills \ No newline at end of file + build_and_publish_docker: + needs: build_and_publish_pypi + uses: neongeckocom/.github/.github/workflows/publish_docker.yml@master + secrets: inherit + with: + image_name: ${{ github.repository_owner }}/neon_skills-default_skills + base_tag: default_skills \ No newline at end of file