Skip to content

ci: change build target #40

ci: change build target

ci: change build target #40

Workflow file for this run

name: release
on:
push:
branches:
- beta
- main
jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
deno: [v1.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}
- name: Lint
run: |
deno fmt --check
deno lint
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
deno: [v1.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}
# - name: Test
# run: deno task test --coverage=coverage
# - name: Generate coverage
# run: deno coverage coverage --output=cov_profile.lcov --lcov
# - uses: codecov/codecov-action@v4
# with:
# files: cov_profile.lcov
# token: ${{ secrets.CODECOV_TOKEN }}
build:
runs-on: ${{ matrix.targets.os }}
strategy:
matrix:
targets:
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.targets.target }}
# - uses: actions/cache@v4
# with:
# path: |
# ~/.cargo/registry
# ~/.cargo/git
# target
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cached cross
uses: baptiste0928/cargo-install@v3
with:
crate: cross
- name: Build
run: ${{ matrix.targets.cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.targets.target }} --locked
- name: Rename artifacts
shell: bash
run: |
find target/${{ matrix.targets.target }}/release -maxdepth 1 \( -name '*.so' -o -name '*.dll' -o -name '*.dylib' \) -exec sh -c '
for file; do
if [ -e "$file" ]; then
mv "$file" "${file%.*}_${{ matrix.targets.target }}.${file##*.}";
fi
done' sh {} +
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.targets.target }}
path: target
release:
needs: [lint, test, build]
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
os: [ubuntu-latest]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: cycjimmy/semantic-release-action@v4
id: semantic
- uses: actions/download-artifact@v4
with:
path: target
- name: Upload releases
if: ${{ steps.semantic.outputs.new_release_published == 'true' }}
uses: softprops/action-gh-release@v1
with:
files: |
target/**/release/*.dylib
target/**/release/*.dll
target/**/release/*.so
tag_name: ${{ steps.semantic.outputs.new_release_git_tag }}