Skip to content

Commit

Permalink
Simple CI for Pull Requests (#247)
Browse files Browse the repository at this point in the history
* Basic CI on PR

* Add workflow dispatch whilst testing

* Remove status action

* Filter for push

* Add single ci target

* Restrictive permissions
  • Loading branch information
ross-p-smith authored Feb 1, 2024
1 parent 30051be commit 88cff26
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build image and run make in dev container
uses: devcontainers/ci@v0.3
with:
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
cacheFrom: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
runCmd: make ci
refFilterForPush: refs/heads/main
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SHELL := /bin/bash

.PHONY: help
.DEFAULT_GOAL := help

ENV_FILE := .env
ifeq ($(filter $(MAKECMDGOALS),config clean),)
ifneq ($(strip $(wildcard $(ENV_FILE))),)
ifneq ($(MAKECMDGOALS),config)
include $(ENV_FILE)
export
endif
endif
endif

help: ## 💬 This help message :)
@grep -E '[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-23s\033[0m %s\n", $$1, $$2}'

ci: unittest build-frontend ## 🚀 Continuous Integration (called by Github Actions)

unittest: ## 🧪 Run the unit tests
@echo -e "\e[34m$@\e[0m" || true
@python -m pytest -m "not azure"

build-frontend: ## 🏗️ Build the Frontend webapp
@echo -e "\e[34m$@\e[0m" || true
@cd code/app/frontend && npm install && npm run build

0 comments on commit 88cff26

Please sign in to comment.