This is a responsive web app built in React.js that allows users to play chess against each other or against an AI opponent. The app is styled with Tailwind CSS and uses an external JavaScript engine for the chess logic. The app is online here.
To install and run the app, you will need to have Node.js and npm (the Node.js package manager) installed on your machine.
- Clone the repository to your local machine:
git clone https://github.com/ElSalvo96/Chess.git
- Navigate to the project directory:
cd Chess
- Install the dependencies:
npm install
- Start the app:
npm start
When you open the app, the game is already set up for human vs. human play and you can move right away. If you want to play against an AI opponent, click on the "Play vs. AI" button. The AI will always play as the black pieces, and you can choose from five different levels of AI difficulty.
Please note that while the AI is thinking, your client performance may decrease due to the engine's calculations.
- React.js
- Tailwind CSS
- JavaScript chess engine named js-chess-engine
To run the test suite for the app, use the following command:
npm test
This will run all of the tests defined in the test directory.
This project uses GitHub Actions for Continuous Integration and Continuous Deployment. With this workflow, the app will be automatically built, tested, and deployed to the GitHub Pages hosting service when code is pushed to the master
branch.
The workflow is defined in the .github/workflows/deploy-on-github-pages.yml
file, and it consists of four jobs:
-
Test job: This job checks out the latest version of the code and installs the necessary dependencies using
npm ci
. It then runs the test suite to ensure that everything is working as expected. Furthermore caches thenode_modules
directory to speed up future builds. -
Build job: This job checks out the latest version of the code, installs the necessary dependencies using npm, and builds the project using npm run build. It then uploads the built artifact to the GitHub Actions artifacts, which will be used in the deployment step.
-
Setup Pages job: This job sets up the environment for GitHub Pages, which will be used in the deployment step.
-
Deploy: If the previous job succeeds, this job deploys the app to GitHub Pages using the built-in
actions/deploy-pages@v2
action. This action automatically sets up the necessary GitHub Pages configuration and deploys the built files from the artifact.
To trigger the workflow, simply push changes to the master
branch of the repository. The workflow will run automatically and deploy the latest changes to the app.
Note that you will need to configure your GitHub Pages settings to serve the deployed app in order for it to be accessible. This can be done in the repository's settings page, under the "GitHub Pages" section.
This project is released under the MIT License. Users are free to use, modify, and distribute the code as long as they credit the original author and include the license in their copies.
Sure, here's the updated section including a step to run tests: