Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CD workflow issues #10

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,51 +1,12 @@
name: CI
name: Deploy to Docker Hub on merge

on:
push:
branches:
- master
workflow_dispatch:
inputs:
forceDockerBuild:
description: 'Force Docker Build'
required: false
default: 'false'

jobs:
automl:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache Python dependencies
uses: actions/cache@v4
id: python_cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run tests
run: |
pip install pytest
pytest

docker:
if: ${{ success() && ( (github.event_name == 'workflow_dispatch' && github.event.inputs.forceDockerBuild == 'true') || github.ref == 'refs/heads/master') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -59,11 +20,6 @@ jobs:
repository: MILO-ML/Processor-Tools
path: preprocessor

- name: Set Node Version to 20
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
Expand Down Expand Up @@ -186,71 +142,3 @@ jobs:
env:
ACR_ADDRESS: ${{ secrets.ACR_ADDRESS }}
CACHE_REPOSITORY: build-cache

authapp:
if: ${{ success() && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Node Version to 20
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: false

- name: Update package version
run: |
sed -i.bak "s|\"version\": \"[0-9\.]*\"|\"version\": \"${{ steps.gitversion.outputs.semVer }}\"|" package.json

- name: Cache UI Dependencies
id: cache_ui
uses: actions/cache@v4
with:
path: ui/node_modules
key: ${{ runner.os }}-ui-${{ hashFiles('ui/package-lock.json') }}
restore-keys: |
${{ runner.os }}-ui-

- name: Install UI dependencies
if: steps.cache_ui.outputs.cache-hit != 'true'
run: npm --prefix ui install

- name: Build AutoML UI
run: npm --prefix ui run build

- name: Prepare staging directory
run: mkdir -p firebase

- name: Copy Firebase Configuration to Staging
run: |
cp firebase.json firebase/
cp firestore.rules firebase/
cp firestore.indexes.json firebase/

- name: Copy Front-End to Staging
run: cp -r static firebase/

- name: Create Firebase Artifact
run: |
cd firebase
zip -r ../payload.zip .
shell: bash

- name: Publish Firebase Hosting Artifact
uses: actions/upload-artifact@v4
with:
name: static
path: payload.zip
53 changes: 53 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: false

- name: Update package version
run: |
sed -i.bak "s|\"version\": \"[0-9\.]*\"|\"version\": \"${{ steps.gitversion.outputs.semVer }}\"|" package.json

- name: Cache UI Dependencies
id: cache_ui
uses: actions/cache@v4
with:
path: ui/node_modules
key: ${{ runner.os }}-ui-${{ hashFiles('ui/package-lock.json') }}
restore-keys: |
${{ runner.os }}-ui-

- name: Install UI dependencies
if: steps.cache_ui.outputs.cache-hit != 'true'
run: npm --prefix ui install

- name: Build AutoML UI
run: npm --prefix ui run build

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_MILO_ML }}
channelId: live
projectId: milo-ml
54 changes: 54 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: false

- name: Update package version
run: |
sed -i.bak "s|\"version\": \"[0-9\.]*\"|\"version\": \"${{ steps.gitversion.outputs.semVer }}\"|" package.json

- name: Cache UI Dependencies
id: cache_ui
uses: actions/cache@v4
with:
path: ui/node_modules
key: ${{ runner.os }}-ui-${{ hashFiles('ui/package-lock.json') }}
restore-keys: |
${{ runner.os }}-ui-

- name: Install UI dependencies
if: steps.cache_ui.outputs.cache-hit != 'true'
run: npm --prefix ui install

- name: Build AutoML UI
run: npm --prefix ui run build

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_MILO_ML }}
projectId: milo-ml
41 changes: 41 additions & 0 deletions .github/workflows/python-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Python Unit Tests

on:
push:
branches:
- master

jobs:
automl:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache Python dependencies
uses: actions/cache@v4
id: python_cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run tests
run: |
pip install pytest
pytest
36 changes: 0 additions & 36 deletions .github/workflows/release.yaml

This file was deleted.