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

APT-576 adding functionality to check if all orgs are the same in foreman.toml #44

Merged
merged 39 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
24435d6
adding functionality to check if all orgs are the same in foreman.toml
afujiwara-roblox Sep 26, 2023
62407c7
enable flag to allow external github orgs
afujiwara-roblox Sep 26, 2023
689c538
whitelist afujiwara-roblox for CLA bot
afujiwara-roblox Sep 26, 2023
55eca19
removed infinite loop
afujiwara-roblox Sep 26, 2023
7fc3606
typo
afujiwara-roblox Sep 26, 2023
eb6c4ea
updated tests
afujiwara-roblox Sep 27, 2023
ba6fdd5
use find-up library instead of going up parent directories ourselves
afujiwara-roblox Sep 28, 2023
d445654
lint
afujiwara-roblox Sep 28, 2023
adcfcb1
updated import
afujiwara-roblox Sep 28, 2023
7ea2827
updated foremanConfig type definition
afujiwara-roblox Sep 28, 2023
3d08eab
Remove redundant condition main.ts
afujiwara-roblox Sep 29, 2023
ac51b7c
check tool sources come from same org setup-foreman runs in
afujiwara-roblox Sep 29, 2023
daebee8
lint
afujiwara-roblox Sep 29, 2023
4697abe
print owner
afujiwara-roblox Sep 29, 2023
e222860
print owner
afujiwara-roblox Sep 29, 2023
f8060a3
print repo
afujiwara-roblox Sep 29, 2023
835e0cc
print repo
afujiwara-roblox Sep 29, 2023
5273acc
lint
afujiwara-roblox Sep 29, 2023
50e36c8
fixed ci
afujiwara-roblox Sep 29, 2023
3f24462
better error message for org not found
afujiwara-roblox Sep 29, 2023
a56fd9f
style and added test
afujiwara-roblox Oct 2, 2023
83d8a1b
continue on error expecting an error
afujiwara-roblox Oct 2, 2023
a5ad851
add failure on success to exepcted failure test case
afujiwara-roblox Oct 2, 2023
421e4cb
fail on success, succeed on failure
afujiwara-roblox Oct 2, 2023
237aa9f
continue on error
afujiwara-roblox Oct 2, 2023
2657c20
test fail case
afujiwara-roblox Oct 2, 2023
671140f
typo
afujiwara-roblox Oct 2, 2023
9971f2f
added id
afujiwara-roblox Oct 2, 2023
d959832
typo
afujiwara-roblox Oct 2, 2023
437c835
test success case
afujiwara-roblox Oct 2, 2023
1f5147c
add test to check same org success
afujiwara-roblox Oct 2, 2023
3c12b46
added all files
afujiwara-roblox Oct 2, 2023
5253048
fix org comparison
afujiwara-roblox Oct 2, 2023
00b0f7a
print org
afujiwara-roblox Oct 2, 2023
d3d58f6
print dirname
afujiwara-roblox Oct 2, 2023
046a993
change directory before checking for foreman config
afujiwara-roblox Oct 2, 2023
714bec1
changed tools for testing
afujiwara-roblox Oct 2, 2023
4f326f0
readd explicit null checks
afujiwara-roblox Oct 3, 2023
b6d8c39
updated readme to include 'allow-external-github-orgs' parameter
afujiwara-roblox Oct 3, 2023
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
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
afujiwara-roblox marked this conversation as resolved.
Show resolved Hide resolved
- 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
Loading