Skip to content

Fixing local github build to also work #3

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

Merged
merged 8 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ env:

jobs:
test:
if: false
runs-on: ubuntu-latest

steps:
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ Example for a blog post about nginx docker compose
Set your environment variables & initialize submodules
```bash
cp .env.sample .env
echo "GH_TOKEN=<SuperSecretGithubToken>" > .env
source .env

git submodule sync
git submodule update --init --recursive

./bin/build_local.sh
```


Expand Down Expand Up @@ -57,3 +60,13 @@ Once the container is up and running, you can hit `http://localhost:8089/` it `/
`http://localhost:8089/backend/` will route you to the backend service.

`http://localhost:8089/api/` will route you to the backend service with the api path.


## Running the Test suite

In the directory `test` you'll find a cypress test suite. In here is our business logic testing. It is a marvel of modern cypriotic book approval/censorship. After you have `bin/build_local.sh` running, follow the instructions in `./test/README.md` and boot up the Cypress tests.

## What on earth are these services?
React1(localhost:8089/) - a frontend application allowing users to reccomend books for listing.
React2(localhost:8089/backend) - Super secret admin panel app allowing admins to approve or deny books for listing
Rails(localhost:8089/api/books) - Api holding the data, performing business logic. ¡Truly revolutionary!
8 changes: 3 additions & 5 deletions bin/build_github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ if [ ! -f .env ]; then
export FRONTEND_BUILD_CONTEXT="https://${GH_TOKEN}@${FRONTEND_REPO_URL}#${FRONTEND_REF}"
export API_BUILD_CONTEXT="https://${GH_TOKEN}@${API_REPO_URL}#${API_REF}"
export BACKEND_BUILD_CONTEXT="https://${GH_TOKEN}@${BACKEND_REPO_URL}#${BACKEND_REF}"

echo "" >> .env
echo "FRONTEND_BUILD_CONTEXT='${FRONTEND_BUILD_CONTEXT}'" >> .env
echo "API_BUILD_CONTEXT='${API_BUILD_CONTEXT}'" >> .env
echo "BACKEND_BUILD_CONTEXT='${BACKEND_BUILD_CONTEXT}'" >> .env
echo "FRONTEND_BUILD_CONTEXT=${FRONTEND_BUILD_CONTEXT}" >> .env
echo "API_BUILD_CONTEXT=${API_BUILD_CONTEXT}" >> .env
echo "BACKEND_BUILD_CONTEXT=${BACKEND_BUILD_CONTEXT}" >> .env
fi

source .env
Expand Down
2 changes: 1 addition & 1 deletion repo_refs/react1-app
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ npm install

```bash
# Open Cypress GUI for development
npm run test:local
npm run test:gui

# Run tests headlessly
npm test
Expand Down
38 changes: 21 additions & 17 deletions test/cypress/e2e/books_flow.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@ describe("Books Flow", () => {
cy.resetTestData();
});

function fillInBookForm({title, publisher, author, isbn}) {
cy.get('input[placeholder="Enter book title"]').type(title);
cy.get('input[placeholder="Enter book publisher"]').type(publisher);
cy.get('input[placeholder="Enter book author"]').type(author);
cy.get('input[placeholder="Enter book ISBN"]').type(isbn);
}

it("allows proposing and approving books", () => {
// Visit React1 app (root path)
cy.visit("/");
cy.contains("Book List");

// Propose a new book
cy.contains("button", "Propose New Book").click();
cy.get('input[placeholder="Enter book title"]').type("Test Book Title");
cy.get('input[placeholder="Enter book publisher"]').type(
"Test Author Name"
);
cy.get('input[placeholder="Enter book author"]').type(
"Test Publisher Name"
);
cy.get('input[placeholder="Enter book ISBN"]').type("1234567890");
fillInBookForm({
title: "Test Book Title",
publisher: "Test Author Name",
author: "Test Publisher Name",
isbn: "1234567890",
});
cy.contains("button", "Submit").click();

// Visit React2 app (/backend path)
Expand All @@ -45,21 +50,20 @@ describe("Books Flow", () => {

it("allows denying provisional books", () => {
// Visit React1 app
cy.visit("/backend");

cy.visit("/");
// Propose a new book
cy.contains("button", "Propose New Book").click();
cy.get('input[placeholder="Enter book title"]').type("Book To Deny");
cy.get('input[placeholder="Enter book publisher"]').type(
"Test Author Name"
);
cy.get('input[placeholder="Enter book author"]').type(
"Test Publisher Name"
);
fillInBookForm({
title: "Book To Deny",
publisher: "Test Author Name",
author: "Test Publisher Name",
isbn: "1234567890",
});
cy.contains("button", "Submit").click();

// Visit React2 app and deny the book
cy.visit("/backend/");
cy.contains("Provisional Books");
cy.contains(".book-item", "Book To Deny")
.contains("button", "Deny")
.click();
Expand Down