diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fd95e1..6238084 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: @@ -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 @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 65dc1a6..f61db85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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] @@ -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