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

Makefile: fix inconsistent builds and help running scripts locally #105

Merged
merged 1 commit into from
Aug 13, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
cache: npm

- name: Install dependencies
run: npm ci
run: make install-dependencies
- name: Build website
run: npm run build
run: make build-website

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protect-readmes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:

- name: Check for changes
run: |
python3 scripts/protect_readmes.py readme-list
make protect-readmes
11 changes: 5 additions & 6 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ jobs:
git config user.name "${{ secrets.GIT_USERNAME }}"

- name: Test pull_readmes script
working-directory: ./osbuild.github.io/scripts
working-directory: ./osbuild.github.io
run: |
python3 test_pull_readmes.py
make test

- name: Pull readmes and fix links
working-directory: ./osbuild.github.io
run: |
python3 scripts/pull_readmes.py readme-list
make pull-readmes

- name: Pull modules
working-directory: ./osbuild.github.io
run: |
python3 scripts/pull_osbuild_modules.py
make pull-osbuild-modules

- name: Setup node
uses: actions/setup-node@v4
Expand All @@ -42,8 +42,7 @@ jobs:
- name: Test build website
working-directory: ./osbuild.github.io
run: |
npm ci
npm run build
make build

- name: Push updates
working-directory: ./osbuild.github.io
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
cache-dependency-path: package-lock.json

- name: Install dependencies
run: yarn install --frozen-lockfile
run: make install-dependencies
- name: Test build website
run: yarn build
run: make build-website
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

.PHONY: help
help:
@echo "make [TARGETS...]"
@echo
@echo 'Targets:'
@awk 'match($$0, /^([a-zA-Z_\/-]+):.*?## (.*)$$/, m) {printf " \033[36m%-30s\033[0m %s\n", m[1], m[2]}' $(MAKEFILE_LIST) | sort

.PHONY: test
.ONESHELL:
test: ## test pulling the readmes from the other projects
pushd scripts
python3 test_pull_readmes.py
popd

.PHONY: pull-readmes
pull-readmes: ## pull the readmes from other projects given in `readme-list`
python3 scripts/pull_readmes.py readme-list

.PHONY: pull-osbuild-modules
pull-osbuild-modules: ## pull the documentation of the osbuild modules
python3 scripts/pull_osbuild_modules.py

.PHONY: generate
generate: pull-readmes pull-osbuild-modules ## generate all external content

.PHONY: install-dependencies
install-dependencies: ## install all dependencies
npm clean-install

.PHONY: build-website
build-website: ## build the website (dependencies need to be met)
npm run build

.PHONY: build
build: install-dependencies build-website ## build the website in one go

.PHONY: run
run: ## run docusaurus locally for testing
npm start

.PHONY: protect-readmes
protect-readmes: ## verify the READMEs don't get changed in a pull request (to be used in the workflow)
python3 scripts/protect_readmes.py readme-list

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati
### Installation

```
$ npm ci
$ make install-dependencies
```

### Local Development

```
$ npm start
$ make run
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ npm run build
$ make build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.