Skip to main content

GitHub Actions

tip

View the comprehensive MadeWithML example for a complete tutorial of CI/CD with Anyscale Jobs and Services.

GitHub Actions allow you to define CI/CD workflows triggered by specific events like pull requests or pushes. Define these workflows in the .github/workflows directory in your repository.

Follow these steps to trigger an Anyscale workload:

  1. Create a workflow file in your repository at .github/workflows/NAME.yaml.
  2. Set up the Anyscale authentication and your cloud service provider credentials so the processes can access the right resources and store results.
  3. Set up dependencies to use during execution.
  4. Use Anyscale CLI commands in the steps of your workflow to submit jobs or deploy services:
    anyscale job submit -f deploy/jobs/workloads.yaml --wait
    anyscale service deploy --service-config-file deploy/services/serve_model.yaml

Submitting an Anyscale Job

The following is a snippet from a sample workflow demonstrating how to submit an Anyscale Job and connect to an AWS S3 bucket. See the complete workloads.yaml on GitHub.

# Run workloads
- name: Workloads
run: |
export ANYSCALE_CLI_TOKEN=${{ secrets.ANYSCALE_CLI_TOKEN }}
anyscale job submit -f deploy/jobs/workloads.yaml --wait

# Read results from S3
- name: Read results from S3
run: |
mkdir results
aws s3 cp s3://madewithml/${{ github.actor }}/results/ results/ --recursive
python .github/workflows/json_to_md.py results/training_results.json results/training_results.md
python .github/workflows/json_to_md.py results/evaluation_results.json results/evaluation_results.md

Deploying an Anyscale Service

The following is a snippet from a sample workflow demonstrating how to rollout an Anyscale Service. See the complete serve.yaml on GitHub.

# Serve model
- name: Serve model
run: |
export ANYSCALE_CLI_TOKEN=${{ secrets.ANYSCALE_CLI_TOKEN }}
anyscale service deploy --service-config-file deploy/services/serve_model.yaml