Skip to content

Commit

Permalink
stash artifacts for branches (#251)
Browse files Browse the repository at this point in the history
* up

* up

* up

* up
  • Loading branch information
ibigbug authored Jan 1, 2024
1 parent 9cf013e commit e9bf74c
Showing 1 changed file with 24 additions and 38 deletions.
62 changes: 24 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,14 @@ name: Build/Test/Release

on:
push:
branches: [ "master" ]
tags:
- v*
branches: [ "*" ]
tags: [ "v*" ]
pull_request:
branches: [ "master" ]

jobs:
test:
name: test on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-13, windows-2022]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: ilammy/setup-nasm@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo check
run: cargo check --all --all-features
- name: Run cargo clippy
run: cargo clippy --all --all-features -- -D warnings
- name: Run cargo test
run: cargo test --all --all-features

publish:
name: publish ${{ matrix.platforms.target }} on ${{ matrix.platforms.os }} static - ${{ matrix.static }}
if: contains(github.ref, 'tags/v')
needs: [test]
runs-on: ${{ matrix.platforms.os }}
name: test ${{ matrix.platforms.target }} on ${{ matrix.platforms.os }} static - ${{ matrix.static }}
strategy:
matrix:
static: [true, false]
Expand All @@ -53,7 +21,9 @@ jobs:
{os: macos-13, target: aarch64-apple-darwin},
{os: macos-13, target: x86_64-apple-darwin},
{os: windows-2022, target: x86_64-pc-windows-msvc},
]
]
runs-on: ${{ matrix.platforms.os }}

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -66,15 +36,31 @@ jobs:
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Build
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo check
run: cargo check --all --all-features
- name: Run cargo clippy
run: cargo clippy --all --all-features -- -D warnings
- name: Run cargo test
run: cargo test --all --all-features
- name: Build artifacts
run: sh ./scripts/build.sh "${{ matrix.platforms.target }}" "${{ matrix.static }}"
- name: Stash artifacts
uses: actions/upload-artifact@v4
with:
name: clash-${{ matrix.platforms.os }}-${{ matrix.platforms.target }}-${{ matrix.static }}
path: target/artifacts/


- name: Create Release
if: contains(github.ref, 'tags/v')
id: create_release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true

- name: Upload Release Asset
if: contains(github.ref, 'tags/v')
id: upload-release-asset
uses: dwenegar/upload-release-assets@v2
env:
Expand Down

0 comments on commit e9bf74c

Please sign in to comment.