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

[pull] master from Roblox:master #7

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
c793cf0
add working dir support
amatosov-rbx May 11, 2022
50645ef
chdir only for install
amatosov-rbx May 11, 2022
88929cf
add test for install with directory
amatosov-rbx May 11, 2022
24474ea
split jobs for cleaner test results
amatosov-rbx May 11, 2022
4d579df
fix warnings
amatosov-rbx May 11, 2022
a0ccf14
resolve path as directory is changed
amatosov-rbx May 11, 2022
b6d9295
Update action.yml
amatosov-rbx May 11, 2022
860246f
Merge pull request #27 from amatosov-rbx/feature/workingDir
ZoteTheMighty May 11, 2022
ff6a0d0
Update linter and config to eliminate vulnerable deps
ZoteTheMighty May 12, 2022
93c89ce
Upgrade jest and typescript, fix some type warnings
ZoteTheMighty May 12, 2022
e453085
Merge pull request #28 from Roblox/fix-vulnerabilities
ZoteTheMighty May 12, 2022
9ca8d65
#nojira need to distinguish between arm64 mac vs x86_64 mac (#31)
yxia-rblx Aug 2, 2022
e86c313
Bump @actions/core from 1.2.6 to 1.9.1
dependabot[bot] Aug 18, 2022
faac4d6
Merge pull request #32 from Roblox/dependabot/npm_and_yarn/actions/co…
ZoteTheMighty Aug 29, 2022
a0b3c90
update CLA signature bot workflow
Jan 18, 2023
c1cee7c
Merge pull request #35 from Roblox/fix/EECI-4699-update-clabot-workflows
rgychiu Jan 19, 2023
47c6b77
Update action to use node16
amatosov-rbx Apr 20, 2023
a478d43
use checkout v3 to avoid warning
amatosov-rbx Apr 20, 2023
b7516a8
use explicit version of node
amatosov-rbx Apr 20, 2023
3f805bb
here as well
amatosov-rbx Apr 20, 2023
8678150
Merge pull request #39 from Roblox/nodejs-16
amatosov-rbx Apr 20, 2023
ba2a1b9
npm audit fix and upgrade (#40)
amatosov-rbx Apr 21, 2023
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
a27b8a4
Merge pull request #44 from Roblox/APT-576
afujiwara-roblox Oct 3, 2023
fca1151
Filter Release Tags (#46)
afujiwara-roblox Nov 2, 2023
58d328b
Support API url override
ghostnaps Dec 18, 2023
0268702
Add new param to action.yml
ghostnaps Dec 18, 2023
5fd6257
Run `npm run all`
ghostnaps Dec 18, 2023
f4613be
Pack compiled source for testing
ghostnaps Dec 18, 2023
45671c7
Remove dist
ghostnaps Mar 5, 2024
91832b9
Revert style changes
ghostnaps Mar 5, 2024
8a2e0ea
Update README
ghostnaps Mar 5, 2024
046168e
Add example
ghostnaps Mar 5, 2024
80fab84
Merge pull request #47 from Roblox/github-enterprise-support
ghostnaps Mar 5, 2024
7e947e4
Add support for artifactory auth (#48)
afujiwara-roblox Mar 29, 2024
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
45 changes: 2 additions & 43 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,13 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/es6"],
"extends": ["plugin:github/typescript"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-ignore": "error",
"camelcase": "off",
"@typescript-eslint/camelcase": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-object-literal-type-assertion": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-interface": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"rules": {},
"env": {
"node": true,
"es6": true,
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/clabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ on:
types: [opened,closed,synchronize]

jobs:
clabot:
runs-on: ubuntu-latest
steps:
- name: "CLA Signature Bot"
uses: roblox/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
whitelist: "LPGhatguy,ZoteTheMighty,cliffchapmanrbx,MagiMaster,MisterUncloaked,amatosov-rbx,dependabot[bot]"
use-remote-repo: true
remote-repo-name: "roblox/cla-bot-store"
remote-repo-pat: ${{ secrets.CLA_REMOTE_REPO_PAT }}
url-to-cladocument: "https://roblox.github.io/cla-bot-store/"
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],afujiwara-roblox"
use-remote-repo: true
remote-repo-name: "roblox/cla-bot-store"
secrets: inherit
93 changes: 90 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,106 @@ on:

jobs:
build:
name: Test setup-foreman action
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- 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
uses: ./
with:
version: "*"
token: ${{ secrets.GITHUB_TOKEN }}
allow-external-github-orgs: true
- run: foreman --version
- run: rojo --version

build-in-dir:
name: Test setup-foreman action with working-directory
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-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
- uses: ./
- name: setup-foreman with working-directory
uses: ./
with:
version: "*"
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: tests
allow-external-github-orgs: true
- run: foreman --version
- run: rojo --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
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,32 @@ A SemVer version range of Foreman to install.

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.

#### `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.

#### `github-api-url` (optional)
Override for the GitHub API URL. By default GitHub Actions will supply this
value as the current environment, which will usually be
`https://api.github.com`.

This parameter exists primarily to allow GitHub Enterprise to point back to
GitHub Cloud to install publicly hosted tools.

As such, for any use of this action in GitHub Enterprise, `github-api-url`
should be included like so:
```yaml
- uses: Roblox/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
github-api-url: "https://api.github.com"
```

## License
setup-foreman is available under the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for details.
setup-foreman is available under the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for details.
79 changes: 79 additions & 0 deletions __tests__/configFile.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import configFile from "../src/configFile";
import foreman from "../src/foreman";
import type { GitHubRelease } from "../src/foreman";
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
);
});

test("filter valid releases", () => {
const releases: GitHubRelease[] = [
{
tag_name: "v1.0.0",
assets: []
},
{
tag_name: "v2.1.0",
assets: []
},
{
tag_name: "v3.0.0-rc.1",
assets: []
},
{
tag_name: "notvalidsemver",
assets: []
},
{
tag_name: "4.3.0",
assets: []
},
{
tag_name: "verybadtag",
assets: []
}
];

const expectedFilteredReleases: GitHubRelease[] = [
{
tag_name: "v1.0.0",
assets: []
},
{
tag_name: "v2.1.0",
assets: []
},
{
tag_name: "v3.0.0-rc.1",
assets: []
}
];
const filteredReleases = foreman.filterValidReleases(releases);
expect(filteredReleases).toEqual(expectedFilteredReleases);
});
5 changes: 0 additions & 5 deletions __tests__/hello.test.ts

This file was deleted.

19 changes: 18 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@ description: 'Install Foreman, a toolchain manager for Roblox projects'
author: 'The Rojo Developers'
inputs:
version:
required: false
description: 'SemVer version of Foreman to install'
working-directory:
required: false
description: 'Working directory to run `foreman install` in'
github-api-url:
required: false
description: 'GitHub API to make requests to'
token:
required: true
description: 'GitHub token from secrets.GITHUB_TOKEN'
allow-external-github-orgs:
required: false
description: 'Allow installing from external GitHub organizations'
artifactory-url:
required: false
description: 'Artifactory URL to use for downloading Foreman tools'
artifactory-token:
required: false
description: 'Artifactory token to use for downloading Foreman tools'
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'
3 changes: 2 additions & 1 deletion foreman.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This file is used as a way to make sure that setup-foreman is functioning.

[tools]
rojo = { source = "Roblox/rojo", version = "0.6.0-alpha.1" }
rojo = { source = "Roblox/rojo", version = "0.6.0-alpha.1" }
selene = { source = "Kampfkarren/selene", version = "0.15.0" }
Loading