To ensure that the changes you make to the site are correct and do not introduce any issues, you can test the compiled Jekyll code locally before merging to the master branch. Follow the steps below to run the Jekyll build and tests locally.
Make sure you have the following installed on your local machine:
- Ruby (version 2.7 or later)
- Bundler
- Docker (optional, for running tests in a containerized environment)
-
Clone the repository to your local machine:
git clone https://github.com/davegoopot/davegoopot.github.io.git cd davegoopot.github.io
-
Install the required gems:
bundle install
-
Build the Jekyll site:
bundle exec jekyll build
-
Serve the site locally to preview the changes:
bundle exec jekyll serve
The site will be available at
http://localhost:4000
. Open this URL in your web browser to preview the changes.
-
Ensure you have Docker installed on your local machine.
-
Run the Jekyll tests using the
jekyll/jekyll
Docker image:docker run --rm -v "$PWD:/srv/jekyll" -it jekyll/jekyll jekyll doctor
This command will run the Jekyll tests and output any issues found with the site.
-
Ensure you have Docker installed on your local machine.
-
Run the Jekyll build:
bundle exec jekyll build
-
Publish the test branch to the GitHub Pages site under the branch URL:
git checkout -b test git add . git commit -m "Test branch" git push origin test
The test branch will be published to the GitHub Pages site under the branch URL. You can manually check the resulting site before merging the changes to master.
You can use GitHub Codespace to test the Jekyll changes before merging to the master branch. Follow the steps below:
- Open the repository in GitHub Codespace.
- Once the Codespace is ready, run the following command to build the Jekyll site:
bundle exec jekyll build
- Serve the site locally to preview the changes:
bundle exec jekyll serve --host 0.0.0.0
- The site will be available at
http://localhost:4000
. Open this URL in your web browser to preview the changes.
The _config.yml
file must be located in the root directory of the repository for the Jekyll site to function correctly. Ensure that the _config.yml
file is in the root directory before running the Jekyll build and tests.