Skip to content

Commit

Permalink
fix: exclude tests from releases #588
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhendrickson13 committed Nov 6, 2024
1 parent 4c2cd72 commit 8c8400a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Build pfSense-pkg-RESTAPI on FreeBSD
run: |
/usr/bin/ssh -o StrictHostKeyChecking=no ${{ matrix.FREEBSD_VERSION }}.jaredhendrickson.com 'sudo pkill ntpd || true && sudo ntpdate pool.ntp.org || true'
/usr/local/bin/python3 tools/make_package.py --host ${{ matrix.FREEBSD_VERSION }}.jaredhendrickson.com --branch ${{ github.sha }} --tag ${{ github.ref_name }} --filename pfSense-${{ matrix.PFSENSE_VERSION }}-pkg-RESTAPI.pkg
/usr/local/bin/python3 tools/make_package.py --host ${{ matrix.FREEBSD_VERSION }}.jaredhendrickson.com --branch ${{ github.sha }} --tag ${{ github.ref_name }} --filename pfSense-${{ matrix.PFSENSE_VERSION }}-pkg-RESTAPI.pkg --notests
- name: Teardown FreeBSD build VM
if: "${{ always() }}"
Expand Down
12 changes: 11 additions & 1 deletion tools/make_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def generate_makefile(self):
}
excluded_files = ["pkg-deinstall.in", "pkg-install.in", "etc", "usr"]

# Remove tests from the package if the user has specified to do so
if self.args.notests:
os.system(f"rm -rf {files_dir.joinpath('usr/local/pkg/RESTAPI/Tests')}")

# Set Jijna2 environment and variables
j2_env = jinja2.Environment(
autoescape=jinja2.select_autoescape([]),
Expand Down Expand Up @@ -131,14 +135,15 @@ def build_on_remote_host(self):
"""Runs the build on a remote host using SSH."""
# Automate the process to pull, install dependencies, build and retrieve the package on a remote host
includes_dir = f"~/build/{REPO_NAME}/{PKG_NAME}/files/usr/local/pkg/RESTAPI/.resources/vendor/"
notests = "--notests" if self.args.notests else ""
build_cmds = [
"mkdir -p ~/build/",
f"rm -rf ~/build/{REPO_NAME}",
f"git clone https://github.com/{REPO_OWNER}/{REPO_NAME}.git ~/build/{REPO_NAME}/",
f"git -C ~/build/{REPO_NAME} checkout " + self.args.branch,
f"composer install --working-dir ~/build/{REPO_NAME}",
f"cp -r ~/build/{REPO_NAME}/vendor/* {includes_dir}",
f"python3 ~/build/{REPO_NAME}/tools/make_package.py --tag {self.args.tag}",
f"python3 ~/build/{REPO_NAME}/tools/make_package.py --tag {self.args.tag} {notests}",
]

# Run each command and exit on bad status if failure
Expand Down Expand Up @@ -213,6 +218,11 @@ def tag(value_string):
required=False,
help="filename to use for the built package file.",
)
parser.add_argument(
"--notests",
dest="notests",
action="store_true",
help="Exclude tests from the package build.",)
self.args = parser.parse_args()


Expand Down

0 comments on commit 8c8400a

Please sign in to comment.