Skip to content

Build Release

Build Release #185

Workflow file for this run

name: Build Release
on:
workflow_dispatch:
inputs:
tag_name:
description: "Optional tag name"
required: false
jobs:
build-ppx-linux:
strategy:
matrix:
platform: [ubuntu-latest]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
defaults:
run:
working-directory: packages/rescript-relay/rescript-relay-ppx
container:
image: alexfedoseev/alpine-node-yarn-esy:0.0.9
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
env:
CI: true
- name: Esy install
run: esy install
- name: Print esy cache
id: print_esy_cache
run: node $GITHUB_WORKSPACE/.github/workflows/print_esy_cache.js
- name: Try to restore dependencies cache
uses: actions/cache@v2
id: deps-cache
with:
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: ${{ matrix.platform }}---v1${{ hashFiles('**/index.json') }}
restore-keys: |
${{ matrix.platform }}---v1
- name: Build PPX
run: esy linux-release-static
- name: Copy built PPX file
run: |
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-linux
- name: Strip binary
run: |
strip ppx-linux
- name: Upload PPX artifact
uses: actions/upload-artifact@v2
with:
name: ppx-linux
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
if-no-files-found: error
build-ppx:
strategy:
matrix:
platform: [
macos-13, # x64
macos-14, # ARM,
windows-latest,
]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
env:
CI: true
- name: Install esy
run: npm install -g esy
- name: Build PPX
uses: esy/github-action@master
with:
cache-key: ${{ matrix.platform }}-${{ hashFiles('esy.lock/index.json') }}-v3
working-directory: packages/rescript-relay/rescript-relay-ppx
- name: Strip PPX binary
if: runner.os != 'Windows'
working-directory: packages/rescript-relay/rescript-relay-ppx
run: |
strip _build/default/bin/RescriptRelayPpxApp.exe
- name: Copy built PPX file
working-directory: packages/rescript-relay/rescript-relay-ppx
run: |
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-${{ matrix.platform }}
- name: Upload PPX artifact ${{ matrix.platform }}
uses: actions/upload-artifact@v2
with:
name: ppx-${{ matrix.platform }}
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
if-no-files-found: error
build-compiler:
name: Build Relay Rust Compiler (${{ matrix.target.os }})
strategy:
matrix:
target:
- target: x86_64-unknown-linux-gnu
os: Ubuntu-20.04
build-name: relay
artifact-name: relay-compiler-linux-x64
- target: x86_64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-compiler-macos-x64
- target: aarch64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-compiler-macos-arm64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
build-name: relay
artifact-name: relay-compiler-linux-musl
packages: musl-tools
features: vendored
- target: x86_64-pc-windows-msvc
os: windows-latest
build-name: relay.exe
artifact-name: relay-compiler-win-x64
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: "true"
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.73.0
override: true
target: ${{ matrix.target.target }}
- name: Install packages
if: matrix.target.os == 'ubuntu-latest' && matrix.target.packages
run: sudo apt update && sudo apt install ${{ matrix.target.packages }} -y
- uses: actions-rs/cargo@v1
with:
command: build
# add --locked back when we have a better way to ensure it's up to date
args: --manifest-path=packages/relay/compiler/Cargo.toml --release --target ${{ matrix.target.target }} ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.target.artifact-name }}
path: packages/relay/compiler/target/${{ matrix.target.target }}/release/${{ matrix.target.build-name }}
build-release:
name: Build release package
runs-on: ubuntu-latest
needs: [build-ppx, build-ppx-linux, build-compiler]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: 16
env:
CI: true
- name: Install esy
run: npm install -g esy
- name: Build PPX
uses: esy/github-action@v1
with:
cache-key: ${{ hashFiles('esy.lock/index.json') }}
working-directory: packages/rescript-relay/rescript-relay-ppx
- name: Build assets
env:
INPUT_TAG_NAME: ${{ github.event.inputs.tag_name }}
run: |
./build-ci.sh
- name: Download artifact relay-compiler-linux-x64
uses: actions/download-artifact@v2
with:
name: relay-compiler-linux-x64
path: binaries/relay-compiler-linux-x64
- name: Download artifact relay-compiler-macos-x64
uses: actions/download-artifact@v2
with:
name: relay-compiler-macos-x64
path: binaries/relay-compiler-macos-x64
- name: Download artifact relay-compiler-macos-arm64
uses: actions/download-artifact@v2
with:
name: relay-compiler-macos-arm64
path: binaries/relay-compiler-macos-arm64
- name: Download artifact relay-compiler-linux-musl
uses: actions/download-artifact@v2
with:
name: relay-compiler-linux-musl
path: binaries/relay-compiler-linux-musl
- name: Download artifact relay-compiler-win-x64
uses: actions/download-artifact@v2
with:
name: relay-compiler-win-x64
path: binaries/relay-compiler-win-x64
- uses: actions/download-artifact@v2
with:
name: ppx-linux
path: binaries
- uses: actions/download-artifact@v2
with:
name: ppx-macos-13
path: binaries
- uses: actions/download-artifact@v2
with:
name: ppx-macos-14
path: binaries
- uses: actions/download-artifact@v2
with:
name: ppx-windows-latest
path: binaries
- name: Rename MacOS old binary
run: |
mv binaries/ppx-macos-13 binaries/ppx-macos-latest
- name: Rename MacOS ARM64 binary
run: |
mv binaries/ppx-macos-14 binaries/ppx-macos-arm64
- name: Move binaries into release directory
run: |
mv binaries/* _release/
- name: Remove artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
ppx-linux
ppx-macos-13
ppx-macos-14
ppx-windows-latest
relay-compiler-linux-x64
relay-compiler-macos-x64
relay-compiler-win-x64
relay-compiler-macos-arm64
relay-compiler-linux-musl
- name: Upload built folder
uses: actions/upload-artifact@v2
with:
name: release-build
path: _release/
- uses: JS-DevTools/npm-publish@v1
if: ${{ github.event.inputs.tag_name }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./_release/package.json
tag: ${{ github.event.inputs.tag_name }}
- uses: JS-DevTools/npm-publish@v1
if: ${{ !github.event.inputs.tag_name }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./_release/package.json