From 1485e8ea128335adada52da1afa1fb3aa6d40553 Mon Sep 17 00:00:00 2001 From: Bazire Houssin Date: Mon, 11 Sep 2023 13:13:53 +0200 Subject: [PATCH] Unifying CI files and re-using PR ci for nightly --- .github/workflows/build-backend.yml | 61 ----- .github/workflows/build-python-client.yml | 91 ------- .github/workflows/build_backend.yml | 228 ++++++++++++++++++ .github/workflows/nightly-test.yml | 113 +-------- .github/workflows/sonar.yml | 77 ------ .../.github/workflows/build-image.yml | 64 ----- .../.github/workflows/install-test.yml | 83 ------- python-client/.github/workflows/publish.yml | 75 ------ 8 files changed, 232 insertions(+), 560 deletions(-) delete mode 100644 .github/workflows/build-backend.yml delete mode 100644 .github/workflows/build-python-client.yml create mode 100644 .github/workflows/build_backend.yml delete mode 100644 .github/workflows/sonar.yml delete mode 100644 python-client/.github/workflows/build-image.yml delete mode 100644 python-client/.github/workflows/install-test.yml delete mode 100644 python-client/.github/workflows/publish.yml diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml deleted file mode 100644 index a23fb66ab9..0000000000 --- a/.github/workflows/build-backend.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Backend -on: - push: - branches: - - main - pull_request: - # https://docs.github.com/fr/actions/using-workflows/workflow-syntax-for-github-actions#exemple--inclusion-de-chemins-dacc%C3%A8s - paths-ignore: - - 'python-client/**' - workflow_dispatch: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - run: echo "$(du -sh $(ls -A ~) 2>/dev/null | sort -hr)" - - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - - name: Checkout code - uses: actions/checkout@v3.3.0 - with: - fetch-depth: 0 - - - name: Setup Gradle # To cache ~/.gradle - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - name: Cache Frontend dependencies - uses: actions/cache@v3 - with: - path: frontend/node_modules - key: ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json')}} - restore-keys: ${{ runner.os }}-frontend - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - - name: Build frontend - env: - GSK_DISABLE_ANALYTICS: True - run: ./gradlew :frontend:build - - - name: Build & test backend - env: - GSK_DISABLE_ANALYTICS: True - run: ./gradlew :backend:build :backend:test :backend:integrationTest :backend:jacocoTestReport --info --parallel - - - run: echo "$(du -sh $(ls -A ~) 2>/dev/null | sort -hr)" diff --git a/.github/workflows/build-python-client.yml b/.github/workflows/build-python-client.yml deleted file mode 100644 index 0747d1b9b4..0000000000 --- a/.github/workflows/build-python-client.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Python-client -on: - push: - branches: - - main - pull_request: - paths: - - 'python-client/**' - workflow_dispatch: - -jobs: - build: - name: Build - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # Do not stop when any job fails - matrix: - python-version: [ "3.8", "3.9", "3.10" ] - os: [ubuntu-latest] - experimental: [false] - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources - include: - - python-version: "3.10" - os: windows-2019 - experimental: false - continue-on-error: ${{ matrix.experimental }} # https://ncorti.com/blog/howto-github-actions-build-matrix - steps: - - - name: Extract branch name - shell: bash - run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT - id: extract_branch - - - name: Checkout code - uses: actions/checkout@v3.3.0 - - - name: Cache Python deps - uses: actions/cache@v3 - with: - path: python-client/.venv - key: ${{ matrix.os }}-${{ matrix.python-version }}-python-deps-${{ hashFiles('python-client/tests/fixtures/**/*py')}} - restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-python-deps - - - name: Setup PDM - uses: pdm-project/setup-pdm@v3 - with: - python-version: ${{ matrix.python-version }} - cache: false # TODO(Bazire): https://linear.app/giskard/issue/GSK-1712/activate-cache-on-pdm-setup-in-github-action - - - name: Set up Pandoc (needed for python-client doc) - uses: r-lib/actions/setup-pandoc@v2 - with: - pandoc-version: '3.1.7' # https://github.com/jgm/pandoc/releases - - - name: Cache Giskard test resources - uses: actions/cache@v3 - with: - path: ~/.giskard - key: ${{ matrix.os }}-${{ matrix.python-version }}-python-test-resources-${{ hashFiles('python-client/tests/fixtures/**/*py')}} - restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-python-giskard-test-resources - - - name: Install dependencies - working-directory: python-client - run: pdm install -G :all - - - name: Lint code - working-directory: python-client - run: pdm run lint - - - name: Test code - working-directory: python-client - env: - PYTEST_XDIST_AUTO_NUM_WORKERS: ${{ matrix.os == 'windows-2019' && 1 || 2 }} - GSK_DISABLE_ANALYTICS: true - run: pdm run test-fast - - - name: Build doc - if : ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'}} - working-directory: python-client - run: pdm run doc - - - name: Build - working-directory: python-client - run: pdm build - - - name: "Python client: archive built artifacts" - if: ${{ steps.extract_branch.outputs.branch == 'main' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }} - uses: actions/upload-artifact@v3 - with: - path: python-client/dist/*whl - diff --git a/.github/workflows/build_backend.yml b/.github/workflows/build_backend.yml new file mode 100644 index 0000000000..468241ff73 --- /dev/null +++ b/.github/workflows/build_backend.yml @@ -0,0 +1,228 @@ +# https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow +# https://docs.github.com/fr/actions/using-workflows/workflow-syntax-for-github-actions#exemple--inclusion-de-chemins-dacc%C3%A8s + +name: Full CI +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + inputs: + run-integration-tests: + description: 'If integration test should be run' + required: true + type: boolean + default: false + workflow_call: + inputs: + run-integration-tests: + description: 'If integration test should be run' + required: true + type: boolean + default: false +env: + GSK_DISABLE_ANALYTICS: true +defaults: + run: + shell: bash +jobs: + pre-check: + name: Pre check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + # Inspired from https://blog.pantsbuild.org/skipping-github-actions-jobs-without-breaking-branch-protection/ + - id: files + name: Get changed files outside python-client + uses: tj-actions/changed-files@v39 + with: + files_ignore: python-client/** + + - id: files-python + name: Get changed files in python-client + uses: tj-actions/changed-files@v39 + with: + files: python-client/** + + - id: python_only + if: steps.files.outputs.any_changed != 'true' + name: Check for changes in python only + run: echo 'python_only=PYTHON_ONLY' >> $GITHUB_OUTPUT + + - id: python_at_least + if: steps.files-python.outputs.any_changed != 'true' + name: Check for changes in python + run: echo 'python_at_least=PYTHON_AT_LEAST' >> $GITHUB_OUTPUT + + sonar: + if: ${{ github.actor != 'dependabot[bot]' && (github.event_name == 'pull_request' || github.event_name == 'push') }} + name: Sonar + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle # To cache ~/.gradle + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Cache SonarQube packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + + - name: Analyze with Sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: ./gradlew sonar --info --parallel + + build: + needs: pre-check + if: ${{ needs.pre-check.outputs.python_only != 'PYTHON_ONLY' }} + name: Backend + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle # To cache ~/.gradle + uses: gradle/gradle-build-action@v2 + with: + cache-read-only: false + + - name: Cache Frontend dependencies + uses: actions/cache@v3 + with: + path: frontend/node_modules + key: ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json')}} + restore-keys: ${{ runner.os }}-frontend + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Build frontend + run: ./gradlew :frontend:build + + - name: Build backend + run: ./gradlew :backend:build --info --parallel + + - name: Unit test + run: ./gradlew :backend:test :backend:jacocoTestReport --info --parallel + + - name: Integration tests + run: ./gradlew :backend:integrationTest --info --parallel + + # Integration Test using postgresql using test-container + - uses: docker-practice/actions-setup-docker@master + if: ${{ inputs.run-integration-tests }} + + - name: Integration test under emulated production env + if: ${{ inputs.run-integration-tests }} + run: ./gradlew :backend:integrationTest --info -Ptestcontainers + + build-python: + name: Build Python + needs: pre-check + if: ${{ needs.pre-check.outputs.python_at_least != 'PYTHON_AT_LEAST' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # Do not stop when any job fails + matrix: + python-version: [ "3.8", "3.9", "3.10" ] + os: [ubuntu-latest] + experimental: [false] + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources + include: + - python-version: "3.10" + os: windows-2019 + experimental: false + continue-on-error: ${{ matrix.experimental }} # https://ncorti.com/blog/howto-github-actions-build-matrix + steps: + - name: Checkout code + uses: actions/checkout@v3.3.0 + + - name: Cache Python deps + uses: actions/cache@v3 + with: + path: python-client/.venv + key: ${{ matrix.os }}-${{ matrix.python-version }}-python-deps-${{ hashFiles('python-client/tests/fixtures/**/*py')}} + restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-python-deps + + - name: Setup PDM + uses: pdm-project/setup-pdm@v3 + with: + python-version: ${{ matrix.python-version }} + cache: false # TODO(Bazire): https://linear.app/giskard/issue/GSK-1712/activate-cache-on-pdm-setup-in-github-action + + - name: Set up Pandoc (needed for python-client doc) + uses: r-lib/actions/setup-pandoc@v2 + with: + pandoc-version: '3.1.7' # https://github.com/jgm/pandoc/releases + + - name: Cache Giskard test resources + uses: actions/cache@v3 + with: + path: ~/.giskard + key: ${{ matrix.os }}-${{ matrix.python-version }}-python-test-resources-${{ hashFiles('python-client/tests/fixtures/**/*py')}} + restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-python-giskard-test-resources + + - name: Install dependencies + working-directory: python-client + run: pdm install -G :all + + - name: Lint code + working-directory: python-client + run: pdm run lint + + - name: Test code + working-directory: python-client + env: + PYTEST_XDIST_AUTO_NUM_WORKERS: ${{ matrix.os == 'windows-2019' && 1 || 2 }} + run: pdm run test-fast + + - name: Build doc + if : ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'}} + working-directory: python-client + run: pdm run doc + + - name: Build + working-directory: python-client + run: pdm build + + - name: "Python client: archive built artifacts" + if: ${{ github.event.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }} + uses: actions/upload-artifact@v3 + with: + path: python-client/dist/*whl + + - name: Run integration tests for python + if: ${{ inputs.run-integration-tests }} + working-directory: python-client + env: + PYTEST_XDIST_AUTO_NUM_WORKERS: ${{ matrix.os == 'windows-2019' && 1 || 2 }} + run: pdm run test \ No newline at end of file diff --git a/.github/workflows/nightly-test.yml b/.github/workflows/nightly-test.yml index 9e5b9534de..0b56dd277a 100644 --- a/.github/workflows/nightly-test.yml +++ b/.github/workflows/nightly-test.yml @@ -5,112 +5,7 @@ on: workflow_dispatch: jobs: - full-test: - name: Full test - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [ "3.8", "3.9", "3.10" ] - steps: - - run: echo "$(du -sh $(ls -A ~) 2>/dev/null | sort -hr)" - - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - - name: Checkout code - uses: actions/checkout@v3.3.0 - with: - fetch-depth: 0 - - - name: Get information of GitHub Action runner - id: runner_info - run: | # FIXME: Won't work on Windows - echo "platform_arch=$(uname -m)" >> "$GITHUB_OUTPUT" - echo "sys_platform=$(uname -o)" >> "$GITHUB_OUTPUT" - - - name: Cache SonarQube packages - uses: actions/cache@v3 - if: ${{ github.actor != 'dependabot[bot]' }} - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - - - name: Cache Frontend dependencies - uses: actions/cache@v3 - with: - path: frontend/node_modules - key: ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json')}} - restore-keys: ${{ runner.os }}-frontend - - - name: Cache Giskard test resources - uses: actions/cache@v3 - with: - path: ~/.giskard - key: ${{ runner.os }}-giskard-test-resources-${{ hashFiles('python-client/tests/fixtures/**/*py')}} - restore-keys: ${{ runner.os }}-giskard-test-resources - - - name: Cache Python dependencies - uses: actions/cache@v3 - with: - path: python-client/.venv - key: ${{ runner.os }}-${{ matrix.python-version }}-client-${{ hashFiles('python-client/pdm.lock')}} - restore-keys: ${{ runner.os }}-client - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - - name: Setup Gradle # To cache ~/.gradle - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Set up Python # Only use this step on x86_64 - if: ${{ steps.runner_info.outputs.platform_arch == 'amd64' || steps.runner_info.outputs.platform_arch == 'x86_64' }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Python and pip through apt - if: ${{ steps.runner_info.outputs.platform_arch != 'amd64' && steps.runner_info.outputs.platform_arch != 'x86_64' }} - run: apt update && apt install -y python3 python3-pip - - - name: Get number of available cores for Python test workers - id: nb_workers - run: python -c 'import os; print(f"nb_workers={max(1,os.cpu_count()-1)}")' >> $GITHUB_OUTPUT - - - name: Run Python commands - run: | - python -m pip install virtualenv -U --upgrade pip - echo "Python ($(which python)) packages:\n $(python -m pip list)" - - - name: Get current date - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - id: current_date - env: - TZ: Europe/Paris - run: echo "CURRENT_DATE=$(date '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - - - name: Test - env: - GSK_DISABLE_ANALYTICS: True - PYTEST_XDIST_AUTO_NUM_WORKERS: ${{ steps.nb_workers.outputs.nb_workers }} - run: ./gradlew build test-all integrationTest :python-client:lint :python-client:package jacocoTestReport --info --parallel - - # Integration Test using postgresql using test-container - - uses: docker-practice/actions-setup-docker@master - - - name: Integration test under emulated production env - env: - GSK_DISABLE_ANALYTICS: True - run: ./gradlew integrationTest -Ptestcontainers - - - run: echo "$(du -sh $(ls -A ~) 2>/dev/null | sort -hr)" + call-full-ci: + uses: ./.github/workflows/build_backend.yml + with: + run-integration-tests: true \ No newline at end of file diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml deleted file mode 100644 index 66d4879ad4..0000000000 --- a/.github/workflows/sonar.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: SonarQube -on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Check if organization member - id: is_organization_member - uses: JamesSingleton/is-organization-member@1.0.1 - with: - organization: Giskard-AI - username: ${{ github.actor }} - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Ask to add the 'safe for build' label - if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.*.labels.*.name, 'safe for build') && steps.is_organization_member.outputs.result == 'false' }} - uses: mshick/add-pr-comment@v2 - with: - message: | - Please add the 'safe for build' label in order to perform the sonar analysis! - - - name: Interrupt job - if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.*.labels.*.name, 'safe for build') && steps.is_organization_member.outputs.result == 'false' }} - shell: bash - run: | - echo "Job failed due to user not being a member of Giskard-AI organization and the 'safe for build' label not being set on the PR" - exit 1 - - - name: Stop on security check failure - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - shell: bash - run: | - echo "Job failed due to user not being a member of Giskard-AI organization and the 'safe for build' label not being set on the PR" - exit 1 - - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - - name: Checkout code - uses: actions/checkout@v3.3.0 - with: - fetch-depth: 0 - - - name: Setup Gradle # To cache ~/.gradle - uses: gradle/gradle-build-action@v2 - with: - cache-read-only: false - - - name: Cache SonarQube packages - uses: actions/cache@v3 - if: ${{ github.actor != 'dependabot[bot]' }} - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - - name: Analyze with Sonar - if: ${{ github.actor != 'dependabot[bot]' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: ./gradlew sonar --info --parallel diff --git a/python-client/.github/workflows/build-image.yml b/python-client/.github/workflows/build-image.yml deleted file mode 100644 index 816e19a0af..0000000000 --- a/python-client/.github/workflows/build-image.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Build ML Worker Docker image and push to registry with dev tag - -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: - -jobs: - build-image: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - id: builder - uses: docker/setup-buildx-action@master - - - name: "Append ARM buildx builder from AWS" - uses: baschny/append-buildx-action@v1 - with: - builder: ${{ steps.builder.outputs.name }} - endpoint: ssh://${{ secrets.ARM_SSH_CONNECTION_STRING }} - ssh_private_key: ${{ secrets.ARM_SSH_PRIVATE_KEY }} - - - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - - name: Login to Docker registry - uses: docker/login-action@v2 - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - with: - username: giskardai - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/bake-action@master - env: - TAG: dev - with: - push: ${{ steps.extract_branch.outputs.branch == 'main' }} - set: | - *.platform=linux/amd64 - *.platform=linux/arm64 - - - - name: Invoke deployment hook - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - run: | - curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-dev - - - name: Remove containers and volumes - run: | - docker system prune -a -f - docker builder prune --force --keep-storage=10GB - - diff --git a/python-client/.github/workflows/install-test.yml b/python-client/.github/workflows/install-test.yml deleted file mode 100644 index 0e0b8c5a71..0000000000 --- a/python-client/.github/workflows/install-test.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Python install - -on: - push: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10" ] - - steps: - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: Cache virtual environment - uses: actions/cache@v3 - with: - path: .venv - key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('pdm.lock')}} - restore-keys: ${{ runner.os }}-venv-${{ matrix.python-version }} - - - name: Upgrade pip - run: python -m pip install --upgrade pip - - - name: Make - run: make - - - name: Replace local coverage.xml path by docker path for Sonar - run: sed -i 's/\/home\/runner\/work\/python-client\/python-client\//\/github\/workspace\//g' coverage.xml - - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: Extract current package version - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - uses: SebRollen/toml-action@v1.0.1 - id: read_toml - with: - file: 'pyproject.toml' - field: 'project.version' - - - name: Get current date - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - id: current_date - env: - TZ: Europe/Paris - run: echo "CURRENT_DATE=$(date '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - - - name: Set dev version - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - uses: ciiiii/toml-editor@1.0.0 - with: - file: "pyproject.toml" - key: "project.version" - value: '${{ steps.read_toml.outputs.value }}.dev${{ steps.current_date.outputs.CURRENT_DATE }}' - - - name: Build dev version - run: | - make build - - - name: Archive built artifacts - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - uses: actions/upload-artifact@v3 - with: - name: giskard-dev-${{ matrix.python-version }}.whl - path: dist/*whl - diff --git a/python-client/.github/workflows/publish.yml b/python-client/.github/workflows/publish.yml deleted file mode 100644 index 2fafb7ccf9..0000000000 --- a/python-client/.github/workflows/publish.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Python package -on: - push: - tags: - - "v*.*.*" -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - id: builder - uses: docker/setup-buildx-action@master - - - name: "Append ARM buildx builder from AWS" - uses: baschny/append-buildx-action@v1 - with: - builder: ${{ steps.builder.outputs.name }} - endpoint: ssh://${{ secrets.ARM_SSH_CONNECTION_STRING }} - ssh_private_key: ${{ secrets.ARM_SSH_PRIVATE_KEY }} - - - name: Set tag name - id: tag - run: | - echo ::set-output name=name::${GITHUB_REF#refs/*/} - echo ::set-output name=version::${GITHUB_REF#refs/*/v} - echo ::set-output name=latest_version::$(git ls-remote --tags origin | grep -Po "v\d+\.\d+\.\d+" | sort -hr | head -1) - - - name: Login to Docker registry - uses: docker/login-action@v2 - with: - username: giskardai - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Make - run: make - -# - name: Build and publish to pypi -# uses: JRubics/poetry-publish@v1.11 -# with: -# pypi_token: ${{ secrets.PYPI_TOKEN }} - - - name: Build +latest ml-worker image - if: ${{ steps.tag.outputs.name == steps.tag.outputs.latest_version }} - env: - IMAGE: docker.io/giskardai/ml-worker - run: | - docker buildx build \ - --platform linux/amd64,linux/arm64 \ - --tag $IMAGE:latest \ - --tag $IMAGE:${{ steps.tag.outputs.version }} \ - --file ./docker/Dockerfile \ - --push \ - . - - - name: Build ml-worker image - if: ${{ steps.tag.outputs.name != steps.tag.outputs.latest_version }} - env: - IMAGE: docker.io/giskardai/ml-worker - run: | - docker buildx build \ - --platform linux/amd64,linux/arm64 \ - --tag $IMAGE:${{ steps.tag.outputs.version }} \ - --file ./docker/Dockerfile \ - --push \ - . - - - name: Invoke deployment hook - run: curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-prod - - - name: Cleanup containers - run: docker builder prune --force --keep-storage=10GB -