Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Feature mla bindings ci #26

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
209 changes: 209 additions & 0 deletions .github/workflows/mla_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
name: mla release

on:
push:
tags:
- "mla-v*"

env:
GITHUB_REF: "${{ github.ref }}"

jobs:
build:
strategy:
matrix:
build: [linux-x86_64, windows-i686, windows-x86_64, windows-i686-debug, windows-x86_64-debug]
include:
- build: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-musl
cargo_arg: --release
path: |
./target/x86_64-unknown-linux-musl/release/libmla.a
- build: windows-i686
os: windows-latest
target: i686-pc-windows-msvc
msvc_platform: Win32
cargo_arg: --release
path: |
./target/i686-pc-windows-msvc/release/mla.lib
./target/i686-pc-windows-msvc/release/mla.dll
./target/i686-pc-windows-msvc/release/mla.dll.lib
./target/i686-pc-windows-msvc/release/mla.pdb
- build: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
msvc_platform: x64
cargo_arg: --release
path: |
./target/x86_64-pc-windows-msvc/release/mla.lib
./target/x86_64-pc-windows-msvc/release/mla.dll
./target/x86_64-pc-windows-msvc/release/mla.dll.lib
./target/x86_64-pc-windows-msvc/release/mla.pdb
- build: windows-i686-debug
os: windows-latest
target: i686-pc-windows-msvc
msvc_platform: Win32
cargo_arg: ""
path: |
./target/i686-pc-windows-msvc/debug/mla.lib
./target/i686-pc-windows-msvc/debug/mla.dll
./target/i686-pc-windows-msvc/debug/mla.dll.lib
./target/i686-pc-windows-msvc/debug/mla.pdb
- build: windows-x86_64-debug
os: windows-latest
target: x86_64-pc-windows-msvc
msvc_platform: x64
cargo_arg: ""
path: |
./target/x86_64-pc-windows-msvc/debug/mla.lib
./target/x86_64-pc-windows-msvc/debug/mla.dll
./target/x86_64-pc-windows-msvc/debug/mla.dll.lib
./target/x86_64-pc-windows-msvc/debug/mla.pdb

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- uses: microsoft/[email protected]
if: matrix.msvc_platform
- name: Build static library
uses: actions-rs/cargo@v1
with:
command: build
args: ${{ matrix.cargo_arg }} --manifest-path=bindings/C/Cargo.toml --target=${{ matrix.target }}
- name: Upload resulting 'mla'
uses: actions/upload-artifact@v2
with:
name: mla-${{ matrix.build }}
path: ${{ matrix.path }}

release:
# From https://github.com/cloudflare/wrangler/blob/master/.github/workflows/release.yml
name: GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:15}"
echo ::set-output name=version::"${GITHUB_REF:15}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: mla-${{ steps.get_version.outputs.VERSION }}
release_name: mla-${{ steps.get_version.outputs.VERSION }}
draft: true

- name: Download linux-x86_64 artifact
uses: actions/download-artifact@v1
with:
name: mla-linux-x86_64

- name: Download windows-i686 artifact
uses: actions/download-artifact@v1
with:
name: mla-windows-i686

- name: Download windows-x86_64 artifact
uses: actions/download-artifact@v1
with:
name: mla-windows-x86_64

- name: Download windows-i686-debug artifact
uses: actions/download-artifact@v1
with:
name: mla-windows-i686-debug

- name: Download windows-x86_64-debug artifact
uses: actions/download-artifact@v1
with:
name: mla-windows-x86_64-debug

- name: Release Linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mla-linux-x86_64/libmla.a
asset_content_type: application/octet-stream
asset_name: libmla-x86_64-static-${{ steps.get_version.outputs.VERSION }}.a

- name: Zip Windows releases
run: |
zip --junk-paths windows-i686 mla-windows-i686/mla.dll mla-windows-i686/mla.lib mla-windows-i686/mla.dll.lib mla-windows-i686/mla.pdb
zip --junk-paths windows-x86_64 mla-windows-x86_64/mla.dll mla-windows-x86_64/mla.lib mla-windows-x86_64/mla.dll.lib mla-windows-x86_64/mla.pdb
zip --junk-paths windows-i686-debug mla-windows-i686-debug/mla.dll mla-windows-i686-debug/mla.lib mla-windows-i686-debug/mla.dll.lib mla-windows-i686-debug/mla.pdb
zip --junk-paths windows-x86_64-debug mla-windows-x86_64-debug/mla.dll mla-windows-x86_64-debug/mla.lib mla-windows-x86_64-debug/mla.dll.lib mla-windows-x86_64-debug/mla.pdb

- name: Release windows-i686
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows-i686.zip
asset_content_type: application/zip
asset_name: libmla-windows-i686-${{ steps.get_version.outputs.VERSION }}.zip

- name: Release windows-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows-x86_64.zip
asset_content_type: application/zip
asset_name: libmla-windows-x86_64-${{ steps.get_version.outputs.VERSION }}.zip

- name: Release windows-i686-debug
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows-i686-debug.zip
asset_content_type: application/zip
asset_name: libmla-windows-i686-debug-${{ steps.get_version.outputs.VERSION }}.zip

- name: Release windows-x86_64-debug
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows-x86_64-debug.zip
asset_content_type: application/zip
asset_name: libmla-windows-x86_64-debug-${{ steps.get_version.outputs.VERSION }}.zip

- uses: actions/checkout@v2
- name: Release C Header file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bindings/C/mla.h
asset_content_type: application/octet-stream
asset_name: mla.h

- name: Release CPP Header file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bindings/C/mla.hpp
asset_content_type: application/octet-stream
asset_name: mla.hpp

Loading