Skip to content

AzureCosmosDB/cosmosdb-linux-emulator-github-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using Azure Cosmos DB Linux emulator (preview) in GitHub Actions

GitHub Actions CI

This repository demonstrates how to use the Azure Cosmos DB Linux emulator in GitHub Actions to run integration tests. It configures the emulator as part of a GitHub Actions CI workflow for Python, Java, .NET, and Go applications on both x64 and ARM64 architectures (demonstrated for Linux runner using ubuntu).

x64 ARM64
Linux Demonstrated in this sample Demonstrated in this sample (GitHub Actions Linux arm64 hosted runners)
Windows GitHub Actions service containers are not supported in non-Linux runners. You can include steps to install Docker and start the container Possible with ARM-based Windows runner
MacOS See license restrictions See license restrictions

Try it out!

To fork this repository, click the Fork button at the top-right corner of the repository page to create a copy of the repository under your own GitHub account. Go to your GitHub account, open the repository and make sure to enable workflows in the repository settings.

Enable workflow

Add the Cosmos DB emulator connection string (COSMOSDB_CONNECTION_STRING) as a Repository secret to the repository. Use the following value: AccountEndpoint=http://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==

Configure secret

Add database name (COSMOSDB_DATABASE_NAME) and container name (COSMOSDB_CONTAINER_NAME) as Repository variables:

Configure variable

Clone your forked repository to your local machine:

git clone https://github.com/your-username/cosmosdb-linux-emulator-github-actions.git
cd cosmosdb-linux-emulator-github-actions

To trigger the workflow, make a small change to any of the code (.NET, Java, Python, or Go), add and commit your changes. Note that only the workflow for the specific language you changed will run.

Push your changes to your forked repository on GitHub:

git add .
git commit -m "Your commit message"
git push origin main

After pushing your changes, GitHub Actions will automatically run the workflow. Go to the Actions tab in your repository to see the status and results of the workflows. Review any logs or output to ensure the workflows are running correctly.

workflow run