Skip to content

Commit

Permalink
rust-release.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
millergarym committed May 2, 2023
1 parent fe6a159 commit ad56334
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/rust-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: rust release

on:
push:
tags:
- rust/compiler/v[0-9]*

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]

steps:
- uses: actions/checkout@v2
# Fetch all history so git describe works
- run: |
git fetch --prune --unshallow
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- uses: actions-rs/cargo@v1
with:
command: build
args: --release

- uses: actions/upload-artifact@v3
with:
name: radlc-${{ runner.os }}
path: target/release/radlc

release:
name: Create Github Release
needs: [build]
runs-on: ubuntu-latest
steps:

- name: Determine version
id: version
run: "echo ::set-output name=version::${GITHUB_REF:11}"

- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Fetch macOS build
uses: actions/download-artifact@v1
with:
name: radlc-macOS
path: radlc-macOS

- name: Fetch linux build
uses: actions/download-artifact@v1
with:
name: radlc-linux
path: radlc-linux

- name: Upload macOS build
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: radlc-macOS
asset_name: radl-bindist-${{ steps.version.outputs.version }}-osx.zip
asset_content_type: application/zip

- name: Upload linux build
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: radlc-linux
asset_name: adl-bindist-${{ steps.version.outputs.version }}-linux.zip
asset_content_type: application/zip
7 changes: 7 additions & 0 deletions rust/compiler/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ cargo +nightly run gen -f adl.work1.json ../../adl/tests/test31/proj
cargo +nightly run gen -f adl.work2.json ../../adl/tests/test31/proj
cargo +nightly run gen -f adl.work3.json ../../adl/tests/test31/proj
```

### Cross compile for linux from mac

```
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" cargo build --release --target x86_64-unknown-linux-musl
```

0 comments on commit ad56334

Please sign in to comment.