Skip to content

Commit

Permalink
Merge pull request #294 from pret/makefile
Browse files Browse the repository at this point in the history
Collapse shell scripts into a Makefile; update INSTALL and CONTRIBUTING docs
  • Loading branch information
lhearachel authored Nov 8, 2024
2 parents 1092f40 + eba6907 commit d8e9bab
Show file tree
Hide file tree
Showing 8 changed files with 454 additions and 273 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png"
CALCROM_DISCORD_WEBHOOK_USERNAME: "OK"
CALCROM_WEBHOOK_URL: "${{ secrets.WEBHOOKURL }}"
BUILD: /var/tmp/pokeplatinum

jobs:
build:
Expand All @@ -30,23 +31,23 @@ jobs:
uses: actions/checkout@v2

- name: Configure Repo
run: ./config.sh /var/tmp/pokeplatinum
run: make configure

- name: Build Repo
run: meson test -C /var/tmp/pokeplatinum
run: make check

- name: Webhook
if: ${{ github.event_name == 'push' }}
env:
arm9name: /var/tmp/pokeplatinum/
arm9name: ${{ vars.BUILD }}
run: |
.github/calcrom/webhook.sh "$CALCROM_WEBHOOK_URL"
continue-on-error: true

- name: Post error archive
if: failure()
continue-on-error: true
run: tar czf failure.tar.gz /var/tmp/pokeplatinum
run: tar czf failure.tar.gz "$BUILD"

- name: Post error upload
if: failure()
Expand All @@ -55,21 +56,21 @@ jobs:
name: pokeplatinum-failure-${{ github.run_id }}
path: failure.tar.gz
retention-days: 1

- name: Checkout xMAP
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
with:
path: 'xmap'
ref: 'xmap'

- name: Move xMAP
if: ${{ github.event_name == 'push' }}
run: |
mkdir -p xmap
cp /var/tmp/pokeplatinum/*.xMAP xmap/platinumus.xMAP
cp "$BUILD/*.xMAP" xmap/platinumus.xMAP
echo "XMAP_COMMIT_MSG=$( git log --format=%s ${GITHUB_SHA} )" >> $GITHUB_ENV
- name: Update xMAP
if: ${{ github.event_name == 'push' }}
uses: EndBug/add-and-commit@v9
Expand Down
57 changes: 36 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,74 @@
# Contributing to pret/pokeplatinum

<!--toc:start-->
- [My Build is Failing After Merging from Main](#my-build-is-failing-after-merging-from-main)
- [Editor Enhancements](#editor-enhancements)
- [Code Formatting](#code-formatting)
- [Contributing to pret/pokeplatinum](#contributing-to-pretpokeplatinum)
- [Preliminaries](#preliminaries)
- [Editor Enhancements](#editor-enhancements)
- [Code Formatting](#code-formatting)
<!--toc:end-->

This document provides a synopsis and loose guidelines for how to contribute to this project. It is a work in progress. Maintainers should expand this document.
This document provides a synopsis and loose guidelines for how to contribute to
this project. It is a work in progress. Maintainers should expand this document.

## My Build is Failing After Merging from Main
## Preliminaries

It is likely that your subprojects are out of date; update them with the following command and re-build:
We contribute using a fork-model rather than committing branches directly to the
repository. Please make a fork before starting work on your contribution.

```
meson subprojects update
Any and all pull requests to the repository *must* produce a ROM which matches
`sha1: ce81046eda7d232513069519cb2085349896dec7` by default. To verify this
locally, a `check` target is included in the `Makefile`:

```bash
make check
```

## Editor Enhancements
This target is run automatically as part of the default `make` command defined
in the provided `Makefile`.

> [!IMPORTANT]
> If your pull request does not produce a matching ROM, then it will not be
> considered for merge until it has been updated to do so.
This repository includes a script to generate a `compile_commands.json` that is compatible with C language servers such as `clangd`.
## Editor Enhancements

### Requirements
This repository includes a script to generate a `compile_commands.json` that is
compatible with C language servers such as `clangd`.

The following dependencies are required:

- `python3.8` or newer
- `gcc-arm-none-eabi`
- `clangd`

### Usage
To run the script:

```bash
./gen_compile_commands.py
```

This will create a file named `compile_commands.json` in the project root, overwriting the previous copy.
This will create a file named `compile_commands.json` in the project root,
overwriting any previous copy.

## Code Formatting

This repository includes an opinionated `clang-format` specification to ensure that we maintain a common code style. For convenience, a pre-commit hook is also provided in `.githooks` which will run `clang-format` against any staged changes prior to executing a commit.

### Requirements
This repository includes an opinionated `clang-format` specification to ensure that
we maintain a common code style. For convenience, a pre-commit hook is also
provided in `.githooks` which will run `clang-format` against any staged changes
prior to executing a commit.

- `clang-format@17` or newer
The following dependencies are required:

### Usage
- `clang-format@18` or newer

To set up the pre-commit hook:

```sh
```bash
git config --local core.hooksPath .githooks/
```

To run the formatter on the full source tree:

```bash
./format.sh
make format
```

Loading

0 comments on commit d8e9bab

Please sign in to comment.