Simplify is_plat() calls in xmake.lua #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
paths-ignore: | |
- '**/*.md' | |
- '.gitignore' | |
- '.vscode/**' | |
pull_request: | |
paths-ignore: | |
- '**/*.md' | |
- '.gitignore' | |
- '.vscode/**' | |
jobs: | |
windows-mingw: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Cache MinGW-w64 and Clang | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
key: ${{ runner.OS }}-cache-${{ hashFiles('.github/workflows/build.yml') }} | |
path: | | |
C:/mingw64 | |
C:/Clang | |
- name: Install MinGW-w64 and Clang (if cache not found) | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
# MinGW-w64 | |
curl.exe -L https://github.com/brechtsanders/winlibs_mingw/releases/download/15.0.0-snapshot20240616posix-12.0.0-ucrt-r1/winlibs-x86_64-posix-seh-gcc-15.0.0-snapshot20240616-mingw-w64ucrt-12.0.0-r1.7z -o mingw64.7z | |
Expand-7zipArchive -Path mingw64.7z -DestinationPath C:\ | |
# Clang | |
curl.exe -L https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.1/LLVM-19.1.1-win64.exe -o LLVM.exe | |
Start-Process -Wait -NoNewWindow -FilePath .\LLVM.exe -ArgumentList "/S /D=C:\Clang" | |
- uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: latest | |
- name: Build | |
run: | | |
$env:Path = "C:\mingw64\bin;" + $env:Path | |
xmake config -p mingw -y | |
xmake | |
- name: clang-tidy | |
run: | | |
$env:Path = "C:\Clang\bin;" + $env:Path | |
./check.ps1 | |
- name: Package to directory | |
run: | | |
# Copy all required files to app binary directory | |
xmake install -o build/install -v | |
# Get git branch+hash or release tag | |
if ($env:GITHUB_REF.StartsWith('refs/tags/')) { | |
$git_artifact_suffix = git describe --tags --abbrev=0 | |
} else { | |
$git_artifact_suffix = "$(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short HEAD)" | |
} | |
Add-Content -Path $env:GITHUB_ENV -Value "git_artifact_suffix=$git_artifact_suffix" | |
# Rename binary dir and append branch+hash or release tag | |
ren build/install/bin minicom2-$git_artifact_suffix-x64 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: minicom2-${{env.git_artifact_suffix}}-windows-x64 | |
path: build/install/* | |
if-no-files-found: error | |
windows-msvc: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: latest | |
- name: Build | |
run: xmake -y | |
- name: clang-tidy | |
run: ./check.ps1 | |
linux-gcc: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install libfuse2 | |
- name: Cache linuxdeploy | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
key: ${{ runner.OS }}-cache-${{ hashFiles('.github/workflows/build.yml') }} | |
path: ~/.local/bin/linuxdeploy | |
- name: Install linuxdeploy (if cache not found) | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ~/.local/bin && cd $_ | |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20240109-1/linuxdeploy-static-x86_64.AppImage -O linuxdeploy | |
chmod +x linuxdeploy | |
- uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: latest | |
- name: Build | |
run: xmake -y | |
- name: clang-tidy | |
run: ./check.sh | |
- name: Package to .AppImage | |
run: | | |
# Create AppImage | |
xmake install -o build/appdir/usr -v | |
cd build | |
xrepo env linuxdeploy --appdir appdir --desktop-file ../app.desktop --icon-file ../icon.png --output appimage | |
# Get git branch+hash or release tag | |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
git_artifact_suffix=$(git describe --tags --abbrev=0) | |
else | |
git_artifact_suffix="$(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short HEAD)" | |
fi | |
echo "git_artifact_suffix=$git_artifact_suffix" >> $GITHUB_ENV | |
# Append branch name and hash (or release tag) to .AppImage filename | |
mv *.AppImage $(basename *.AppImage -x86_64.AppImage)-$git_artifact_suffix-x64.AppImage | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: minicom2-${{env.git_artifact_suffix}}-linux-x64 | |
path: build/*.AppImage | |
if-no-files-found: error |