Skip to content

Commit

Permalink
restore files from default branch
Browse files Browse the repository at this point in the history
  • Loading branch information
frascuchon committed May 10, 2024
1 parent d2f9e51 commit 853a5af
Show file tree
Hide file tree
Showing 137 changed files with 1,377 additions and 255 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/build-push-dev-frontend-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build Argilla Docker image

on:
workflow_call:
inputs:
download-python-package:
description: "True if python package should be downloaded"
type: boolean
default: false
image-name:
description: "Name of the image to build"
required: true
type: string
dockerfile:
description: "Path to the Dockerfile to build"
required: true
type: string
platforms:
description: "Platforms to build for"
required: true
type: string
build-args:
description: "Build arguments"
required: false
type: string
default: ""
readme:
description: "Path to the README file"
required: false
type: string
default: "README.md"
outputs:
version:
description: "Version of the Docker image"
value: ${{ jobs.build.outputs.version }}
google-docker-image:
description: The name of the Docker image uploaded to Google Artifact Registry.
value: ${{ jobs.build.outputs.google-docker-image }}

jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest

# Grant permissions to `GITHUB_TOKEN` for Google Cloud Workload Identity Provider
permissions:
contents: read
id-token: write

outputs:
version: ${{ steps.docker-image-tag-from-ref.outputs.docker-image-tag }}
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Build Frontend
working-directory: frontend
run: |
npm install
npm run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Get Docker image tag from GITHUB_REF
id: docker-image-tag-from-ref
uses: ./.github/actions/docker-image-tag-from-ref

- name: Generate Docker tags
id: generate-docker-tags
run: |
GCP_REGISTRY_TAG="europe-docker.pkg.dev/argilla-ci/$IMAGE_NAME:$DOCKER_IMAGE_TAG"
echo "tags=$GCP_REGISTRY_TAG" >> $GITHUB_OUTPUT
env:
IMAGE_NAME: ${{ inputs.image-name }}
DOCKER_IMAGE_TAG: ${{ steps.docker-image-tag-from-ref.outputs.docker-image-tag }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.AR_DOCKER_USERNAME }}
password: ${{ secrets.AR_DOCKER_PASSWORD }}

# Authenticate in GCP using Workload Identity Federation, so we can push the Docker image to the Google Cloud Artifact Registry
- name: Authenticate to Google Cloud
id: google-auth
uses: 'google-github-actions/auth@v1'
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WIP }}
service_account: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT }}

- name: Login to Google Artifact Registry
uses: docker/login-action@v2
with:
registry: europe-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.google-auth.outputs.access_token }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: frontend
file: ${{ inputs.dockerfile }}
platforms: ${{ inputs.platforms }}
tags: ${{ steps.generate-docker-tags.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: ${{ inputs.build-args }}
push: true
32 changes: 32 additions & 0 deletions .github/workflows/build-python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build Argilla package

on:
workflow_call:

jobs:
build:
name: Build the python package
runs-on: ubuntu-latest
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v3

- name: Cache pip 👜
uses: actions/cache@v3
env:
# Increase this value to reset cache if pyproject.toml has not changed
CACHE_NUMBER: 0
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ env.CACHE_NUMBER }}-${{ hashFiles('pyproject.toml') }}

- name: Build Package 🍟
run: |
pip install -U build
rm -rf dist && python -m build
- name: Upload package artifact
uses: actions/upload-artifact@v3
with:
name: python-package
path: dist
56 changes: 56 additions & 0 deletions .github/workflows/check-repo-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Check repository files

on:
workflow_call:
outputs:
pythonChanges:
description: "True if some files in python code have changed"
value: ${{ jobs.check-repo-files.outputs.pythonChanges }}
end2endChanges:
description: "True if some files in python code have changed"
value: ${{ jobs.check-repo-files.outputs.end2endChanges }}
buildChanges:
description: "True if some files affecting the build have changed"
value: ${{ jobs.check-repo-files.outputs.buildChanges }}
frontendChanges:
description: "True if some files affecting the frontend folder changed"
value: ${{ jobs.check-repo-files.outputs.frontendChanges }}

jobs:
check-repo-files:
name: Check repo files
runs-on: ubuntu-latest
outputs:
pythonChanges: ${{ steps.path_filter.outputs.pythonChanges }}
buildChanges: ${{ steps.path_filter.outputs.buildChanges }}
end2endChanges: ${{ steps.path_filter.outputs.end2endChanges }}
frontendChanges: ${{ steps.path_filter.outputs.frontendChanges }}
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v3
- name: Check affected files
uses: dorny/paths-filter@v2
id: path_filter
with:
filters: |
pythonChanges:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'setup.py'
end2endChanges:
- 'src/**'
- 'pyproject.toml'
- 'setup.py'
- 'scripts/end2end_examples.py'
- 'docs/_source/tutorials_and_integrations/tutorials/feedback/end2end_examples/**'
frontendChanges:
- 'frontend/**'
buildChanges:
- 'src/**'
- 'frontend/**'
- 'pyproject.toml'
- 'setup.py'
- 'docker/**'
- '.dockerignore'
- '.github/workflows/**'
41 changes: 41 additions & 0 deletions .github/workflows/close-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Close Pull Request

on:
pull_request:
types: [closed]

jobs:
teardown_pr_environment:
name: Teardown Cloud Run PR environment
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository

# Grant permissions to `GITHUB_TOKEN` for Google Cloud Workload Identity Provider
permissions:
contents: read
id-token: write

steps:
- uses: "actions/checkout@v3"

- name: Authenticate to Google Cloud
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WIP }}
service_account: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT }}

- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v1"
with:
version: ">= 435.0.0"

- name: Remove PR environment if exists
run: |
service_name="argilla-quickstart-pr-${{ github.event.pull_request.number }}"
services=$(gcloud run services list --project=argilla-ci --format="value(metadata.name)")
if echo "$services" | grep -q "$service_name"; then
echo "Service '$service_name' exists. Removing it..."
gcloud run services delete $service_name --project=argilla-ci --region=europe-southwest1 --quiet
else
echo "Service $service_name does not exist."
fi
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [main, master, releases/*]
pull_request:
# The branches below must be a subset of the branches above
branches: [main, master, releases/*]
schedule:
- cron: "33 6 * * 3"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["javascript", "python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
27 changes: 27 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: "Dependency Review"
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3
- name: "Dependency Review"
uses: actions/dependency-review-action@v1
Loading

0 comments on commit 853a5af

Please sign in to comment.