Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Sep 23, 2023
0 parents commit 4f418b6
Show file tree
Hide file tree
Showing 35 changed files with 2,374 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
AlignAfterOpenBracket: AlwaysBreak
AllowShortFunctionsOnASingleLine: None
AlwaysBreakAfterReturnType: None
BasedOnStyle: Webkit
BreakBeforeBinaryOperators: NonAssignment
ColumnLimit: 80
IndentPPDirectives: BeforeHash
NamespaceIndentation: None
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Right
SortIncludes: false
26 changes: 26 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build Docker toolchain

on:
- workflow_dispatch

jobs:
publish_docker_image:
name: Build Docker toolchain
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Checkout code
uses: actions/checkout@v2
with:
path: .
fetch-depth: 0

- name: Build Docker image
run: |
docker build -t "rrdash/tomb2main:latest" . -f docker/game-win/Dockerfile
docker push "rrdash/tomb2main:latest"
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run code linters

on:
- push
- pull_request

jobs:
lint:
name: Run code linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: .
fetch-depth: 0

- name: Install dependencies
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' | sudo tee -a /etc/apt/sources.list
echo 'deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt-get install -y clang-format-12 iwyu
sudo ln -s /usr/bin/clang-format-12 /usr/local/bin/clang-format
sudo apt-get install -y make python3-pip
sudo python3 -m pip install pyjson5
- name: Check imports
run: |
git add -A
python3 tools/sort_imports
git diff --exit-code || ( echo 'Please run `make imports` and commit the changes.'; exit 1 )
- name: Check formatted code differences
run: |
make lint
git diff --exit-code || ( echo 'Please run `make lint` and commit the changes.'; exit 1 )
139 changes: 139 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@

name: Publish a new release

permissions:
contents: write

on:
push:
branch: stable
tags:
- 'v?[0-9]*'
workflow_call:
inputs:
draft:
description: 'Draft'
required: true
default: false
type: boolean
prerelease:
description: 'Prerelease'
required: true
type: boolean
workflow_dispatch:
inputs:
draft:
description: 'Draft'
required: true
default: true
type: boolean
prerelease:
description: 'Prerelease'
required: true
default: false
type: boolean

jobs:
publish_release:
name: Create a GitHub release
runs-on: ubuntu-latest
needs: [package_game_win]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: .
fetch-depth: 0

- name: Download built game asset
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game-win-all

- name: Extract tag name
id: get_version
run: echo ::set-output name=VERSION::$(git describe --abbrev=7 --tags)

- name: Rename assets
run: |
mv artifacts/game-win.zip artifacts/Tomb2Main-${{ steps.get_version.outputs.VERSION }}-Windows.zip
- name: Generate Changelog
run: |
python3 -c '''
import re
from pathlib import Path
section = [s for s in Path("CHANGELOG.md").read_text().split("\n\n") if re.search("- \w", s)][0]
print("\n".join(line for line in section.splitlines() if not line.startswith("#")))
''' > artifacts/changes.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ github.ref_name }}
body_path: artifacts/changes.txt
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
fail_on_unmatched_files: true
files: |
artifacts/Tomb2Main-${{ steps.get_version.outputs.VERSION }}-Windows.zip
build_game_win:
name: Build the game (Windows)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: .
fetch-depth: 0

- name: Install dependencies
run: |
echo "$GITHUB_CONTEXT"
sudo apt-get update
sudo apt-get install -y make moby-engine moby-cli
- name: Build the game
run: |
make clean release
mkdir out/
cp build/win/*.exe out/
cp build/win/*.dll out/
cp -r bin/* out/
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game-win
path: out/

package_game_win:
name: Package the game (Windows)
needs: [build_game_win]
runs-on: ubuntu-latest
steps:
- name: Download built game assets
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game-win

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make p7zip-full
- name: Package the game
run: |
mkdir out
cd artifacts
7z a ../out/game-win.zip *
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game-win-all
path: out/game-win.zip
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: local
hooks:
- id: clang-format
name: clang-format
entry: clang-format
args: ["-style=file", "-i"]
language: system
files: \.[ch](pp)?$

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## [Unreleased](https://github.com/rr-/Tomb2Main/compare/stable...develop) - ××××-××-××
Loading

0 comments on commit 4f418b6

Please sign in to comment.