Skip to content

Build/Test/Release #259

Build/Test/Release

Build/Test/Release #259

Workflow file for this run

name: Build/Test/Release
on:
push:
branches: [ "master" ]
tags:
- v*
pull_request:
branches: [ "master" ]
jobs:
test:
name: test on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
# https://github.com/bazelbuild/rules_rust/issues/1966
# maybe we should not use bazel anymore
# - run: CARGO_BAZEL_ISOLATED=0 CARGO_BAZEL_REPIN=true bazelisk test --test_output=all //clash_lib/... //clash/...
- uses: Swatinem/rust-cache@v2
- run: cargo test --all --all-features
publish:
if: contains(github.ref, 'tags/v')
needs: [test]
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
matrix:
os: [ubuntu-22.04, macos-13]
include:
- os: ubuntu-22.04
container: quay.io/pypa/manylinux_2_28_x86_64
targets: >
x86_64-unknown-linux-gnu
# aarch64-unknown-linux-gnu
- os: macos-13
targets: >
aarch64-apple-darwin
x86_64-apple-darwin
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Build
run: sh ./scripts/build.sh "${{ matrix.targets }}"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
- name: Upload Release Asset
id: upload-release-asset
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
assets_path: target/artifacts