forked from PuqiAR/Fig-TreeWalker
test act runner3 !
This commit is contained in:
@@ -1,18 +1,173 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ github.actor }} is testing out Gitea Actions
|
||||
on: [push]
|
||||
name: Release Build
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "版本号 (如: 1.0.0)"
|
||||
required: true
|
||||
default: "dev"
|
||||
|
||||
env:
|
||||
VERSION: ${{ github.event.inputs.version || github.ref_name }}
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
linux-x64:
|
||||
runs-on: ubuntu
|
||||
steps:
|
||||
- run: echo " The job was automatically triggered by a ${{ github.event_name }} event."
|
||||
- run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo " The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||
- name: Check out repository code
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- run: echo " The ${{ github.repository }} repository has been cloned to the runner."
|
||||
- run: echo " ️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
|
||||
- name: Install xmake
|
||||
run: |
|
||||
ls ${{ github.workspace }}
|
||||
- run: echo " This job's status is ${{ job.status }}."
|
||||
curl -fsSL https://xmake.io/shget.text | bash
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
xmake f -p linux -a x86_64 -m release
|
||||
xmake -j$(nproc)
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
mkdir -p Fig-${{ env.VERSION }}-linux-x86_64
|
||||
cp build/linux/x86_64/release/Fig Fig-${{ env.VERSION }}-linux-x86_64/
|
||||
cp -r src/Module/Library Fig-${{ env.VERSION }}-linux-x86_64/
|
||||
tar -czf Fig-${{ env.VERSION }}-linux-x86_64.tar.gz Fig-${{ env.VERSION }}-linux-x86_64
|
||||
|
||||
- name: Create Checksum
|
||||
run: |
|
||||
sha256sum Fig-${{ env.VERSION }}-linux-x86_64.tar.gz > sha256sum.txt
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Fig-${{ env.VERSION }}-linux-x86_64
|
||||
path: |
|
||||
Fig-${{ env.VERSION }}-linux-x86_64.tar.gz
|
||||
sha256sum.txt
|
||||
|
||||
linux-arm64:
|
||||
runs-on: ubuntu
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install xmake and cross compiler
|
||||
run: |
|
||||
curl -fsSL https://xmake.io/shget.text | bash
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
xmake f -p linux -a arm64 -m release --toolchain=/usr/bin/aarch64-linux-gnu
|
||||
xmake -j$(nproc)
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
mkdir -p Fig-${{ env.VERSION }}-linux-arm64
|
||||
cp build/linux/arm64/release/Fig Fig-${{ env.VERSION }}-linux-arm64/
|
||||
cp -r src/Module/Library Fig-${{ env.VERSION }}-linux-arm64/
|
||||
tar -czf Fig-${{ env.VERSION }}-linux-arm64.tar.gz Fig-${{ env.VERSION }}-linux-arm64
|
||||
|
||||
- name: Create Checksum
|
||||
run: |
|
||||
sha256sum Fig-${{ env.VERSION }}-linux-arm64.tar.gz > sha256sum.txt
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Fig-${{ env.VERSION }}-linux-arm64
|
||||
path: |
|
||||
Fig-${{ env.VERSION }}-linux-arm64.tar.gz
|
||||
sha256sum.txt
|
||||
|
||||
windows-x64:
|
||||
runs-on: ubuntu
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install xmake and mingw
|
||||
run: |
|
||||
curl -fsSL https://xmake.io/shget.text | bash
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mingw-w64
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
xmake f -p mingw -a x86_64 -m release
|
||||
xmake -j$(nproc)
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
mkdir -p Fig-${{ env.VERSION }}-windows-x86_64
|
||||
cp build/mingw/x86_64/release/Fig.exe Fig-${{ env.VERSION }}-windows-x86_64/
|
||||
cp -r src/Module/Library Fig-${{ env.VERSION }}-windows-x86_64/
|
||||
zip -r Fig-${{ env.VERSION }}-windows-x86_64.zip Fig-${{ env.VERSION }}-windows-x86_64
|
||||
|
||||
- name: Create Checksum
|
||||
run: |
|
||||
sha256sum Fig-${{ env.VERSION }}-windows-x86_64.zip > sha256sum.txt
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Fig-${{ env.VERSION }}-windows-x86_64
|
||||
path: |
|
||||
Fig-${{ env.VERSION }}-windows-x86_64.zip
|
||||
sha256sum.txt
|
||||
|
||||
create-release:
|
||||
needs: [linux-x64, linux-arm64, windows-x64]
|
||||
runs-on: ubuntu
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
- name: Combine checksums
|
||||
run: |
|
||||
cat */sha256sum.txt > all-checksums.txt
|
||||
echo "=== SHA256 Checksums ===" > checksums.txt
|
||||
cat all-checksums.txt >> checksums.txt
|
||||
echo "" >> checksums.txt
|
||||
echo "Generated at: $(date)" >> checksums.txt
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: Release ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Release Assets
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
for file in Fig-${{ env.VERSION }}-*.tar.gz Fig-${{ env.VERSION }}-*.zip; do
|
||||
if [ -f "$file" ]; then
|
||||
echo "Uploading $file"
|
||||
curl -X POST \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$file" \
|
||||
"https://git.fig-lang.cn/api/v1/repos/${{ github.repository }}/releases/${{ github.ref_name }}/assets?name=$(basename $file)"
|
||||
fi
|
||||
done
|
||||
|
||||
# 上传 checksums.txt
|
||||
curl -X POST \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: text/plain" \
|
||||
--data-binary @checksums.txt \
|
||||
"https://git.fig-lang.cn/api/v1/repos/${{ github.repository }}/releases/${{ github.ref_name }}/assets?name=checksums.txt"
|
||||
|
||||
19
xmake.lua
19
xmake.lua
@@ -7,20 +7,15 @@ target("Fig")
|
||||
set_kind("binary")
|
||||
set_languages("c++23")
|
||||
|
||||
if is_plat("windows") then
|
||||
set_plat("mingw")
|
||||
if is_plat("linux") then
|
||||
add_cxxflags("-static-libstdc++", "-static-libgcc")
|
||||
add_ldflags("-static")
|
||||
elseif is_plat("mingw") then
|
||||
add_cxxflags("-static")
|
||||
add_ldflags("-Wl,--stack,268435456")
|
||||
|
||||
elseif is_plat("linux") then
|
||||
add_ldflags("-static-libstdc++", "-static-libgcc")
|
||||
end
|
||||
|
||||
if is_plat("windows") then
|
||||
set_filename("Fig.exe")
|
||||
else
|
||||
set_filename("Fig")
|
||||
add_ldflags("-static")
|
||||
end
|
||||
|
||||
add_ldflags("-Wl,--stack,268435456")
|
||||
|
||||
|
||||
add_files("src/main.cpp")
|
||||
|
||||
Reference in New Issue
Block a user