Skip to content

Commit

Permalink
Add initial files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan-Greve committed Mar 10, 2024
0 parents commit a3bcac5
Show file tree
Hide file tree
Showing 11 changed files with 565 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Greetings

on: [pull_request_target, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Message that will be displayed on users' first issue"
pr-message: "Message that will be displayed on users' first pull request"
153 changes: 153 additions & 0 deletions .github/workflows/linux_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Linux CD

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64, x86]

runs-on: ${{ matrix.os }}

concurrency:
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-Linux
cancel-in-progress: true

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install xmake
run: |
wget https://xmake.io/shget.text -O - | bash
echo "/home/runner/.local/bin" >> $GITHUB_PATH
- name: Install latest GCC
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y
sudo apt-get update
sudo apt install -y g++-13 gcc-13
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60 --slave /usr/bin/g++ g++ /usr/bin/g++-13
sudo apt-get install -y gcc-13-multilib g++-13-multilib
- name: Print GCC version
run: gcc --version

- name: Set xmake package cache path
run: echo "XMAKE_PKG_CACHEDIR=$(pwd)/xmake-cache" >> $GITHUB_ENV

- name: Retrieve xmake cache for packages
uses: actions/cache@v4
with:
path: xmake-cache
key: ${{ matrix.os }}-${{ matrix.arch }}

- name: Build with GCC
run: |
xmake f -v -a ${{ matrix.arch }} --toolchain=gcc -y
xmake -vD -y
- name: Get target name
id: get_target_name
run: |
targetName=$(grep 'target' xmake.lua | cut -d'"' -f 2)
echo "::set-output name=target_name::$targetName"
- name: Rename executable
run: mv "build/linux/${{ matrix.arch }}/release/${{ steps.get_target_name.outputs.target_name }}" "build/linux/${{ matrix.arch }}/release/${{ steps.get_target_name.outputs.target_name }}_${{ matrix.arch }}"

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: executable-${{ matrix.arch }}
path: build/linux/${{ matrix.arch }}/release/${{ steps.get_target_name.outputs.target_name }}_${{ matrix.arch }}

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract version
id: extract_version
run: |
VERSION=$(grep 'set_version' xmake.lua | cut -d'"' -f 2)
echo "::set-output name=version::$VERSION"
- name: Check if tag exists
id: check_tag
run: |
git fetch --tags
if git rev-parse ${{ steps.extract_version.outputs.version }} >/dev/null 2>&1; then
echo "Tag already exists"
else
echo "Tag does not exist. Continuing to next step."
echo "::set-output name=tag_exists::false"
fi
- name: Create Tag
id: create_tag
if: steps.check_tag.outputs.tag_exists == 'false'
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git tag -a ${{ steps.extract_version.outputs.version }} -m "Release ${{ steps.extract_version.outputs.version }}"
git push origin ${{ steps.extract_version.outputs.version }}
- name: Generate Changelog
id: generate_changelog
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match "*.*.*" $(git rev-list --tags --skip=1 --max-count=1))
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
git log --no-merges --pretty="%h - %s (%an)<br />" $PREVIOUS_TAG..$VERSION > CHANGELOG.md
- name: Get target name
id: get_target_name
run: |
targetName=$(grep 'target' xmake.lua | cut -d'"' -f 2)
echo "::set-output name=target_name::$targetName"
- name: Download x86_64 artifact
uses: actions/download-artifact@v2
with:
name: executable-x86_64

- name: Download x86 artifact
uses: actions/download-artifact@v2
with:
name: executable-x86

- name: Display structure of downloaded files
run: ls -R

- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fail_on_unmatched_files: true
tag_name: ${{ steps.extract_version.outputs.version }}
name: Release ${{ steps.extract_version.outputs.version }}
body_path: CHANGELOG.md
files: |
${{ steps.get_target_name.outputs.target_name }}_x86_64
${{ steps.get_target_name.outputs.target_name }}_x86
142 changes: 142 additions & 0 deletions .github/workflows/windows_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Windows CD

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-2022]
arch: [x64, x86]

runs-on: ${{ matrix.os }}

concurrency:
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-Windows
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest

- name: Set xmake package cache path
run: echo "XMAKE_PKG_CACHEDIR=$(pwd)/xmake-cache" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Retrieve xmake cache for packages
uses: actions/cache@v4
with:
path: xmake-cache
key: ${{ matrix.os }}-${{ matrix.arch }}

- name: Set release arch name
run: |
if ("${{ matrix.arch }}" -eq "x64") {
Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
} else {
Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
}
- name: Build
run: |
xmake f -v -a ${{ matrix.arch }} -y
xmake -vD -y
- name: Get target name
id: get_target_name
run: |
$targetName = (Select-String -Path xmake.lua -Pattern 'target\("(.+)"\)' | ForEach-Object { $_.Matches.Groups[1].Value })
echo "::set-output name=target_name::$targetName"
- name: Rename exe file
run: mv "build/windows/${{ matrix.arch }}/release/${{ steps.get_target_name.outputs.target_name }}.exe" "build/windows/${{ matrix.arch }}/release/${{ steps.get_target_name.outputs.target_name }}_${{ matrix.arch }}.exe"

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: exe-file-${{ matrix.arch }}
path: build/windows/${{ matrix.arch }}/release/${{ steps.get_target_name.outputs.target_name }}_${{ matrix.arch }}.exe

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure you fetch all history for all branches and tags

- name: Extract version
id: extract_version
run: |
VERSION=$(grep 'set_version' xmake.lua | cut -d'"' -f 2)
echo "::set-output name=version::$VERSION"
- name: Check if tag exists
id: check_tag
run: |
git fetch --tags
if git rev-parse ${{ steps.extract_version.outputs.version }} >/dev/null 2>&1; then
echo "Tag already exists"
else
echo "Tag does not exist. Continuing to next step."
echo "::set-output name=tag_exists::false"
fi
- name: Create Tag
id: create_tag
if: steps.check_tag.outputs.tag_exists == 'false'
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git tag -a ${{ steps.extract_version.outputs.version }} -m "Release ${{ steps.extract_version.outputs.version }}"
git push origin ${{ steps.extract_version.outputs.version }}
- name: Generate Changelog
id: generate_changelog
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match "*.*.*" $(git rev-list --tags --skip=1 --max-count=1))
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
git log --no-merges --pretty="%h - %s (%an)<br />" $PREVIOUS_TAG..$VERSION > CHANGELOG.md
- name: Get target name
id: get_target_name
run: |
targetName=$(grep 'target' xmake.lua | cut -d'"' -f 2)
echo "::set-output name=target_name::$targetName"
- name: Download x64 artifact
uses: actions/download-artifact@v2
with:
name: exe-file-x64

- name: Download x86 artifact
uses: actions/download-artifact@v2
with:
name: exe-file-x86

- name: Display structure of downloaded files
run: ls -R

- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fail_on_unmatched_files: true
tag_name: ${{ steps.extract_version.outputs.version }}
name: Release ${{ steps.extract_version.outputs.version }}
body_path: CHANGELOG.md
files: |
${{ steps.get_target_name.outputs.target_name }}_x64.exe
${{ steps.get_target_name.outputs.target_name }}_x86.exe
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Xmake cache
.xmake/
build/

# MacOS Cache
.DS_Store


/.vs
/.vscode
/vsxmake2022
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
Loading

0 comments on commit a3bcac5

Please sign in to comment.