diff --git a/.actrc b/.actrc deleted file mode 100644 index 85619c8b0a9..00000000000 --- a/.actrc +++ /dev/null @@ -1 +0,0 @@ --P ubuntu-latest=nektos/act-environments-ubuntu:18.04 \ No newline at end of file diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000000..2d4e445e81a --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,5 @@ +# Testing + +To test workflows, use the GitHub CLI and trigger the workflow from a branch. + +For more information see the [GitHub CLI documentation](https://cli.github.com/manual/gh_workflow_run). \ No newline at end of file diff --git a/.github/workflows/testing/README.md b/.github/workflows/testing/README.md deleted file mode 100644 index 5aa679738af..00000000000 --- a/.github/workflows/testing/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# Local testing of GitHub Actions -Leverage the knowledge from https://github.com/nektos/act for detailed instructions. - -## Install -### 1. Install Docker -Required to run GitHub Actions on VMs. Choose your preferred Docker setup https://docs.docker.com/get-docker/. - -### 2. Install Nektos -Required to run GitHub Actions locally. - -```bash -brew install nektos/tap/act -``` - -### 3. Install Azure CLI -Required to integrate GitHub Actions and Azure. - -```bash -azure login -``` - -## Configure -1. The `.actrc` file contains the default configuration and run methods. -2. Run this Bash script `ci-act-event.sh` to dynamically generate the required configuration file for Act. Two questions will be asked to collect the local git branch name and GitHub event. An example might look like `.github/workflows/testing/push.json` where "push" is the github.event to trigger a GitHub Action against the branch named inside that same file. This file is `.gitignored` so it will need regenerated for testing. - -```bash -cd .github/workflows/testing -bash ci-act-event.sh -``` - -A new file `{some-name}.json` will be generated inside `/testing/`. This is the local git branch that `Act` will run. - -Run the event from the `/testing/*` folder as indicated with `-W` or `--workflows` arguments. - -```bash -$ act -e `.github/workflows/testing/${github_event}.json` -W "./.github/workflows/testing/" -``` - -## Test -`./.github/workflows/testing/ci-daily-local.yml` is used to test locally CI settings. - -Run this command from root -```bash -$ act -j build_local_linux -e "./.github/workflows/testing/${github_event}.json" -W "./.github/workflows/testing/" -``` -## Cleanup -When installing packages on docker instances, if versions change, it's important to kill the docker instance and rebuild. - -Determine what instances are running. -```bash -$ docker ps -``` - -Copy and paste the "CONTAINER ID" as the argument of `kill`. -```bash -$ docker kill 2ecf895e7be3 -``` - -Remove the image. -```bash -$ docker rm 2ecf895e7be3 -``` - diff --git a/.github/workflows/testing/ci-act-event.sh b/.github/workflows/testing/ci-act-event.sh deleted file mode 100644 index e1115bf0ccf..00000000000 --- a/.github/workflows/testing/ci-act-event.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -echo " ------------------------------------------------------------------------------------------------ " -echo "| This script will dynamically create an event.json file for use by Nektos/Act in testing GitHub |" -echo "| Actions locally. |" -echo " -------------------------------------------------------------------------------------------------" - -# Ask for Branch Name -echo -n "Enter git branch name? " -read branch_name - -# Ask for Event Type -echo -n "Enter the GitHub Event to trigger the GitHub Action? " -read github_event - -# Combine user inputs into the json template -# Set contents of the file to be overwritten -echo '{ - "push": { - "head": { - "ref": "'$branch_name'" - }, - "base": { - "ref": "'$branch_name'" - } - } - }' >& $github_event.json - diff --git a/.github/workflows/testing/ci-daily-local.yml b/.github/workflows/testing/ci-daily-local.yml deleted file mode 100644 index ff9faeb7b24..00000000000 --- a/.github/workflows/testing/ci-daily-local.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: CI - FAST Local Testing - -on: - push: - branches: - - users/* - -jobs: - build_local_linux: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Add/Update packages - run: | - sudo apt-get update - sudo apt-get install yarn - sudo yarn global upgrade typescript - sudo yarn global add lerna@5.5.2 - - - name: Install package dependencies / prepare workspaces - run: yarn install --frozen-lockfile - - - name: Testing Prettier format - run: lerna run prettier:diff - - - name: Testing units - run: lerna run test --stream diff --git a/build/helpers/__tests__/src/bar/bar.ts b/build/helpers/__tests__/src/bar/bar.ts deleted file mode 100644 index 87c1ff593dc..00000000000 --- a/build/helpers/__tests__/src/bar/bar.ts +++ /dev/null @@ -1 +0,0 @@ -export default class Bar {} diff --git a/build/helpers/__tests__/src/bar/index.ts b/build/helpers/__tests__/src/bar/index.ts deleted file mode 100644 index 8fb18cc232f..00000000000 --- a/build/helpers/__tests__/src/bar/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import Bar from "./bar"; -export { Bar }; diff --git a/build/helpers/__tests__/src/foo/foo.ts b/build/helpers/__tests__/src/foo/foo.ts deleted file mode 100644 index 7804111002d..00000000000 --- a/build/helpers/__tests__/src/foo/foo.ts +++ /dev/null @@ -1 +0,0 @@ -export default class Foo {} diff --git a/build/helpers/__tests__/src/foo/index.ts b/build/helpers/__tests__/src/foo/index.ts deleted file mode 100644 index 993fb691db1..00000000000 --- a/build/helpers/__tests__/src/foo/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import Foo from "./foo"; -export default Foo; diff --git a/build/helpers/__tests__/src/index.ts b/build/helpers/__tests__/src/index.ts deleted file mode 100644 index 38d914e0a84..00000000000 --- a/build/helpers/__tests__/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Example formatting from fast-components-react-base - */ -import Foo from "./foo"; -export { Foo }; -export * from "./foo"; - -/** - * Example formatting from fast-component-react-msft - */ -export * from "./bar"; diff --git a/build/helpers/__tests__/src/missingExport.ts b/build/helpers/__tests__/src/missingExport.ts deleted file mode 100644 index 7ec37687402..00000000000 --- a/build/helpers/__tests__/src/missingExport.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Example with missing exports - */ -export * from "./bar"; \ No newline at end of file diff --git a/build/helpers/file-includes-all-subdirectories-as-named-exports.spec.ts b/build/helpers/file-includes-all-subdirectories-as-named-exports.spec.ts deleted file mode 100644 index 6e3867061f4..00000000000 --- a/build/helpers/file-includes-all-subdirectories-as-named-exports.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import path from "path"; -import { includesAllSubdirectoriesAsNamedExports } from "./file-includes-all-subdirectories-as-named-exports"; - -describe("file-includes-all-subdirectories-as-named-exports.ts", (): void => { - test("should export all components in the __tests__ directory index.ts", () => { - expect(() => { - includesAllSubdirectoriesAsNamedExports(path.resolve(__dirname, "__tests__/src/index.ts")); - }).not.toThrow(); - }); - - test("should throw an error if exports are missing in the __tests__ directory missingExport.ts", () => { - expect(() => { - includesAllSubdirectoriesAsNamedExports(path.resolve(__dirname, "__tests__/src/missingExport.ts")) - }).toThrow(); - }); -}); diff --git a/build/helpers/file-includes-all-subdirectories-as-named-exports.ts b/build/helpers/file-includes-all-subdirectories-as-named-exports.ts deleted file mode 100644 index dd8b51c3ffe..00000000000 --- a/build/helpers/file-includes-all-subdirectories-as-named-exports.ts +++ /dev/null @@ -1,32 +0,0 @@ -import path from "path"; -import fs from "fs"; -import { pascalCase } from "../../packages/utilities/fast-web-utilities"; - -/** - * Verifies all components in source directory are exported, directories listed in "excludes" parameter are ignored - */ -export function includesAllSubdirectoriesAsNamedExports( - indexFile: string, - excludes?: string[] -): boolean { - // Get the folders in the indexFile directory to compare to export listing - const directoryPath: string = path.dirname(indexFile); - const components: string[] = fs - .readdirSync(directoryPath) - .map((name: string) => path.join(directoryPath, name)) - .filter((source: string) => fs.statSync(source).isDirectory()) - .map((entry: string) => pascalCase(path.basename(entry))); - - // Get listing of all exports and compare against folder listings - const foundExports: any = Object.keys(require(path.resolve(__dirname, indexFile))); - const missingExports: string[] = components.filter( - (component: string) => - !foundExports.includes(component) && excludes.indexOf(component) !== -1 - ); - - if (missingExports.length === 0) { - return true; - } else { - throw new Error(`Missing exports: ${missingExports}`); - } -}