Skip to content

Commit

Permalink
Merge pull request #44 from Roblox/APT-576
Browse files Browse the repository at this point in the history
APT-576 adding functionality to check if all orgs are the same in foreman.toml
  • Loading branch information
afujiwara-roblox authored Oct 3, 2023
2 parents ba2a1b9 + b6d8c39 commit a27b8a4
Show file tree
Hide file tree
Showing 10 changed files with 649 additions and 435 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
call-clabot-workflow:
uses: Roblox/cla-signature-bot/.github/workflows/clabot-workflow.yml@master
with:
whitelist: "LPGhatguy,ZoteTheMighty,cliffchapmanrbx,MagiMaster,MisterUncloaked,amatosov-rbx,dependabot[bot]"
whitelist: "LPGhatguy,ZoteTheMighty,cliffchapmanrbx,MagiMaster,MisterUncloaked,amatosov-rbx,dependabot[bot],afujiwara-roblox"
use-remote-repo: true
remote-repo-name: "roblox/cla-bot-store"
secrets: inherit
58 changes: 57 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
with:
version: "*"
token: ${{ secrets.GITHUB_TOKEN }}
allow-external-github-orgs: true
- run: foreman --version
- run: rojo --version

Expand All @@ -38,7 +39,6 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -54,5 +54,61 @@ jobs:
version: "*"
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: tests
allow-external-github-orgs: true
- run: foreman --version
- run: selene --version

external-org-false-failure:
name: Test allow-external-gitub-org false expect failure
strategy:
matrix:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run all
- run: npm run pack

- name: setup-foreman-failure
uses: ./
id: setup-foreman-failure
with:
version: "*"
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: tests
allow-external-github-orgs: false
continue-on-error: true

- name: fail on success
if: steps.setup-foreman-failure.outcome == 'success'
run: exit 1

- name: succeed on failure
run: exit 0

external-org-false-success:
name: Test allow-external-gitub-org false expect success
strategy:
matrix:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run all
- run: npm run pack

- name: setup-foreman-success
uses: ./
with:
version: "*"
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: tests-external-org
allow-external-github-orgs: false
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ If not specified, the latest stable release will be installed.
#### `working-directory` (optional)
A working directory in which `foreman install` will be executed.

If not specified the root job folder will be used
If not specified the root job folder will be used.

#### `allow-external-github-orgs` (optional)
A boolean value to allow external github orgs in the foreman manifest file.

If not specified, external github orgs will not be allowed.
## License
setup-foreman is available under the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for details.
32 changes: 32 additions & 0 deletions __tests__/configFile.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import configFile from "../src/configFile";
import {parse} from "toml";

test("get off my back, Jest", () => {
expect(5).toEqual(5);
});

test("checkSameOrgToolSpec same org", () => {
let config = `
[tools]\n
tool1 = { source = "org1/tool1", version = "1.0.0" }\n
tool2 = { source = "org1/tool2", version = "1.0.0" }\n
tool3 = { source = "org1/tool3", version = "1.0.0" }\n
`;
let manifestContent = parse(config);
expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual(
true
);
});

test("checkSameOrgToolSpec different org", () => {
let config = `
[tools]\n
tool1 = { source = "org1/tool1", version = "1.0.0" }\n
tool2 = { source = "org2/tool2", version = "1.0.0" }\n
tool3 = { source = "org1/tool3", version = "1.0.0" }\n
`;
let manifestContent = parse(config);
expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual(
false
);
});
5 changes: 0 additions & 5 deletions __tests__/hello.test.ts

This file was deleted.

Loading

0 comments on commit a27b8a4

Please sign in to comment.