Skip to content

Commit

Permalink
fix artifacts build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackhr-arch committed Aug 30, 2024
1 parent 0c77be9 commit c2acddf
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 0

- name: Cache Target
- name: Cache
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@v4
with:
Expand All @@ -32,21 +32,24 @@ jobs:
ci-${{ runner.os }}-${{ hashFiles('./Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
- name: Test
run: |
cargo install --debug cargo-make
cargo make ci
- name: Build
run: cargo make upx

- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
name: Artifacts-${{ runner.os }}
path: artifacts
retention-days: 5

release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

needs: build

Expand All @@ -60,14 +63,6 @@ jobs:
merge-multiple: true
path: ./artifacts

- name: UPX compress
run: |
chmod +x ./artifacts/*
curl -OL https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz
tar -xf upx-4.2.4-amd64_linux.tar.xz
cp ./upx-4.2.4-amd64_linux/upx .
./upx ./artifacts/*
- name: Create Release
uses: softprops/action-gh-release@v2
with:
Expand Down
36 changes: 35 additions & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@

[env]
# use for build arm64 in docker
CROSS_CONTAINER_IN_CONTAINER = true
# CROSS_CONTAINER_IN_CONTAINER = true


[tasks.ci]
dependencies = ["setup_mihomo", "ci-flow"]
script = ["rm mihomo", "rm Doc/clash_test/cache.db"]

[tasks.ci.windows]
# ignore this shit
dependencies = []
script = ""

[tasks.setup_mihomo.windows]
script_runner = "pwsh"
script_extension = "ps1"
script = '''
curl --output mihomo.zip -L https://github.com/MetaCubeX/mihomo/releases/download/v1.18.4/mihomo-windows-amd64-v1.18.4.zip
7z x mihomo.zip
Expand Down Expand Up @@ -43,7 +50,9 @@ script = '''
'''

[tasks.clear-artifacts]
private = true
script_runner = "@shell"
ignore_errors = true
script = ["rm -r artifacts"]

[tasks.build_deb]
Expand All @@ -63,3 +72,28 @@ script = '''
cargo build --bin clashtui --all-features
cargo build --bin clashtui --all-features --release
'''


[tasks.upx.linux]
dependencies = ["release"]
script = '''
chmod +x artifacts/*
curl -OL https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz
tar -xf upx-4.2.4-amd64_linux.tar.xz
rm upx-4.2.4-amd64_linux.tar.xz
cp ./upx-4.2.4-amd64_linux/upx .
rm -r ./upx-4.2.4-amd64_linux
./upx artifacts/*.release artifacts/*.debug
rm upx
'''

[tasks.upx.windows]
dependencies = ["release"]
script = '''
curl -OL https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip
tar -xf upx-4.2.4-win64.zip
cp ./upx-4.2.4-win64/upx.exe .
rm -r ./upx-4.2.4-win64
./upx.exe artifacts/*.exe
rm upx.exe
'''

0 comments on commit c2acddf

Please sign in to comment.