CI for website (#1469)

## Description

CI for website, useful for dependabot tests.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [x] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic
words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>
This commit is contained in:
Abin Simon 2022-11-15 11:10:53 +05:30 committed by GitHub
parent 825cd6f21b
commit 2e33f37cee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 1 deletions

View File

@ -9,6 +9,9 @@ on:
docfileschanged:
description: "'true' if docs/** or src/** or .github/workflows/** files have changed in the branch"
value: ${{ jobs.file-change-check.outputs.docfileschanged }}
websitefileschanged:
description: "'true' if websites/** or .github/workflows/** files have changed in the branch"
value: ${{ jobs.file-change-check.outputs.websitefileschanged }}
jobs:
file-change-check:
@ -19,6 +22,7 @@ jobs:
outputs:
srcfileschanged: ${{ steps.srcchecker.outputs.srcfileschanged }}
docfileschanged: ${{ steps.docchecker.outputs.docfileschanged }}
websitefileschanged: ${{ steps.websitechecker.outputs.websitefileschanged }}
steps:
- uses: actions/checkout@v3
@ -33,6 +37,8 @@ jobs:
- 'src/**'
docs:
- 'docs/**'
website:
- 'website/**'
actions:
- '.github/workflows/**'
- '.github/actions/**'
@ -49,4 +55,11 @@ jobs:
if: steps.dornycheck.outputs.src == 'true' || steps.dornycheck.outputs.docs == 'true' || steps.dornycheck.outputs.actions == 'true'
run: |
echo "docs, src or workflow file changes occurred"
echo ::set-output name=docfileschanged::true
echo ::set-output name=docfileschanged::true
- name: Check dorny for changes in website related filepaths
id: websitechecker
if: steps.dornycheck.outputs.website == 'true' || steps.dornycheck.outputs.actions == 'true'
run: |
echo "website or workflow file changes occurred"
echo ::set-output name=websitefileschanged::true

34
.github/workflows/website-ci.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: CI for Website
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
# cancel currently running jobs if a new version of the branch is pushed
concurrency:
group: website-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Precheck:
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main
Website-Build:
needs: [Precheck]
environment: Testing
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || needs.precheck.outputs.websitefileschanged == 'true'
defaults:
run:
working-directory: website
steps:
- uses: actions/checkout@v3
- name: Build website image
run: |
make buildimage
- name: Build website
run: |
make build

View File

@ -2,6 +2,11 @@
WEBC := docker run --rm -it --init -p 5050:3000 -p 5051:3001 \
-v ${PWD}:/usr/src/website corso/website:latest
ifeq (${CI},true)
# Cannot run in interactive/tty mode in CI
WEBC := docker run --rm --init -p 5050:3000 -p 5051:3001 \
-v ${PWD}:/usr/src/website corso/website:latest
endif
buildimage: clean
docker build -t "corso/website:latest" .