Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 48 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Release

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

env:
CARGO_TERM_COLOR: always
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
MACOSX_DEPLOYMENT_TARGET: '10.13'

jobs:
Expand All @@ -17,14 +17,15 @@ jobs:

strategy:
matrix:
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
include:
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu

steps:
- name: Checkout
Expand All @@ -39,11 +40,43 @@ jobs:
with:
key: ${{ matrix.target }}

- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
- name: Install gcc-aarch64-linux-gnu
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Build
run: cargo build --release --target ${{ matrix.target }}
run: cargo build -p native --release --target ${{ matrix.target }}

- name: Move Build
run: mv target/${{ matrix.target }}/release/native cjs-module-lexer-${{ matrix.target }}

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cjs-module-lexer-${{ matrix.target }}
path: cjs-module-lexer-${{ matrix.target }}
if-no-files-found: error

release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: .artifact

- name: Gzip Artifact
run: gzip .artifact/*

- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: .artifact/cjs-module-lexer-*.gz
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = ["native", "lexer", "wasm"]
resolver = "2"

[profile.release.package.cjs-module-lexer]
# optimization for size (more aggressive)
opt-level = "z"

[profile.release]
Expand All @@ -14,7 +15,6 @@ panic = "abort"
strip = "symbols"
# optimization over all codebase (better optimization, slower build)
codegen-units = 1
# optimization for size
# opt-level = 's'
# link time optimization using using whole-program analysis
lto = true
incremental = false
Loading