chore: Setup Git LFS in workflows

This commit adds a step to the GitHub workflows (`test-release.yaml` and `release.yml`) to setup Git LFS. Git LFS is necessary for handling large files in the repository. By installing Git LFS, we ensure that the repository can handle large files properly during the CI/CD process.
This commit is contained in:
Simon Larsen 2024-07-12 20:28:46 +01:00
parent 3c29278cc1
commit d514059d5d
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
6 changed files with 71 additions and 11 deletions

View File

@ -1031,6 +1031,9 @@ jobs:
with:
node-version: 18.3.0
- name: Setup Git LFS
run: git lfs install
# Cannot do this, no space on the gitHub standard runner. We need to use the large runner which is selfhosted
- name: Download the Model from Hugging Face
run: mkdir -p ./LLM/Models && cd ./LLM/Models && git clone https://${{ secrets.HUGGING_FACE_USERNAME }}:${{ secrets.HUGGING_FACE_PASSWORD }}@huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct

View File

@ -59,6 +59,9 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- name: Setup Git LFS
run: git lfs install
# Cannot do this, no space on the gitHub standard runner. We need to use the large runner which is selfhosted
- name: Download the Model from Hugging Face

View File

@ -24,6 +24,7 @@ import CopilotActionStatus from "Common/Types/Copilot/CopilotActionStatus";
import PullRequest from "Common/Types/CodeRepository/PullRequest";
import ServiceCopilotCodeRepository from "Model/Models/ServiceCopilotCodeRepository";
import CopilotActionProcessingException from "./Exceptions/CopilotActionProcessingException";
import CopilotPullRequest from "Model/Models/CopilotPullRequest";
// import ArrayUtil from "Common/Types/ArrayUtil";
let currentFixCount: number = 1;
@ -57,6 +58,10 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
await setUpRepository();
await refreshAllPullRequestsStatuses({
codeRepositoryResult,
});
for (const serviceToImrove of codeRepositoryResult.servicesToImprove) {
checkIfCurrentFixCountIsLessThanFixNumberOfCodeEventsInEachRun();
@ -277,6 +282,39 @@ const setUpRepository: PromiseVoidFunction = async (): Promise<void> => {
}
// if the repo is not set up properly, then check if there's an outstanding setup Pr for this repo.
logger.info("Setting up the repository.");
// check if there's an outstanding setup PR for this repo.
const setupPullRequest: CopilotPullRequest | null =
await CodeRepositoryUtil.getOpenSetupPullRequest();
if (setupPullRequest) {
logger.info(
`There's an open setup PR for this repository: ${setupPullRequest.pullRequestId}. Please merge this PR to continue using Copilot. Exiting...`,
);
haltProcessWithSuccess();
return;
}
// if there's no setup PR, then create a new setup PR.
const pullRequest: PullRequest = await CodeRepositoryUtil.setUpRepo();
logger.info(
"Repository setup PR created - #" +
pullRequest.pullRequestId +
". Please megre this PR to continue using Copilot. Exiting..",
);
haltProcessWithSuccess();
};
type RefreshAllPullRequestsStatusesFunction = (data: {
codeRepositoryResult: CodeRepositoryResult;
}) => Promise<void>;
const refreshAllPullRequestsStatuses: RefreshAllPullRequestsStatusesFunction =
async (_data: {
codeRepositoryResult: CodeRepositoryResult;
}): Promise<void> => {};
export default init;

View File

@ -23,6 +23,7 @@ import ServiceCopilotCodeRepository from "Model/Models/ServiceCopilotCodeReposit
import Text from "Common/Types/Text";
import Execute from "CommonServer/Utils/Execute";
import CopilotPullRequestService from "../Service/CopilotPullRequest";
import CopilotPullRequest from "Model/Models/CopilotPullRequest";
export interface CodeRepositoryResult {
codeRepository: CopilotCodeRepository;
@ -49,6 +50,19 @@ export default class CodeRepositoryUtil {
public static gitHubUtil: GitHubUtil | null = null;
public static folderNameOfClonedRepository: string | null = null;
public static async getOpenSetupPullRequest(): Promise<CopilotPullRequest | null> {
const openPullRequests: Array<CopilotPullRequest> =
await CopilotPullRequestService.getOpenPullRequestsFromDatabase();
for (const pullRequest of openPullRequests) {
if (pullRequest.isSetupPullRequest) {
return pullRequest;
}
}
return null;
}
public static getLocalRepositoryPath(): string {
if (this.folderNameOfClonedRepository) {
return LocalFile.sanitizeFilePath(
@ -108,12 +122,12 @@ export default class CodeRepositoryUtil {
return pullRequest.state;
}
public static async setUpRepo(): Promise<void> {
public static async setUpRepo(): Promise<PullRequest> {
// check if the repository is setup properly.
const isRepoSetupProperly: boolean = await this.isRepoSetupProperly();
if (isRepoSetupProperly) {
return;
throw new BadDataException("Repository is already setup properly.");
}
// otherwise, we copy the folder /usr/src/app/Templates/.oneuptime to the repository folder.
@ -165,7 +179,10 @@ export default class CodeRepositoryUtil {
await CopilotPullRequestService.addPullRequestToDatabase({
pullRequest: pullRequest,
isSetupPullRequest: true,
});
return pullRequest;
}
public static async isRepoSetupProperly(): Promise<boolean> {

View File

@ -1,24 +1,24 @@
import { Green500, Purple500, Red500 } from "Common/Types/BrandColors";
import CopilotPullRequestStatus from "Common/Types/Copilot/CopilotPullRequestStatus";
import PullRequestState from "Common/Types/CodeRepository/PullRequestState";
import Pill from "CommonUI/src/Components/Pill/Pill";
import React, { FunctionComponent, ReactElement } from "react";
export interface ComponentProps {
pullRequestStatus: CopilotPullRequestStatus;
pullRequestStatus: PullRequestState;
}
const PullRequestStatusElement: FunctionComponent<ComponentProps> = (
props: ComponentProps,
): ReactElement => {
if (props.pullRequestStatus === CopilotPullRequestStatus.Created) {
if (props.pullRequestStatus === PullRequestState.Open) {
return <Pill color={Green500} text={"Open"} />;
}
if (props.pullRequestStatus === CopilotPullRequestStatus.Merged) {
if (props.pullRequestStatus === PullRequestState.Merged) {
return <Pill color={Purple500} text={"Merged"} />;
}
if (props.pullRequestStatus === CopilotPullRequestStatus.Closed) {
if (props.pullRequestStatus === PullRequestState.Closed) {
return <Pill color={Red500} text={"Closed"} />;
}

View File

@ -7,7 +7,7 @@ import Navigation from "CommonUI/src/Utils/Navigation";
import CopilotPullRequest from "Model/Models/CopilotPullRequest";
import React, { Fragment, FunctionComponent, ReactElement } from "react";
import DropdownUtil from "CommonUI/src/Utils/Dropdown";
import CopilotPullRequestStatus from "Common/Types/Copilot/CopilotPullRequestStatus";
import PullRequestState from "Common/Types/CodeRepository/PullRequestState";
import PullRequestStatusElement from "../../../../Components/CodeRepository/PullRequestStatus";
const CopilotPullRequestPage: FunctionComponent<
@ -61,9 +61,8 @@ const CopilotPullRequestPage: FunctionComponent<
},
title: "Pull Request Status",
type: FieldType.Dropdown,
filterDropdownOptions: DropdownUtil.getDropdownOptionsFromEnum(
CopilotPullRequestStatus,
),
filterDropdownOptions:
DropdownUtil.getDropdownOptionsFromEnum(PullRequestState),
},
]}
columns={[