Skip to content

Commit

Permalink
compile and release
Browse files Browse the repository at this point in the history
  • Loading branch information
timglabisch committed Mar 22, 2022
1 parent b45b138 commit f6877a7
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI
on:
push:
branches:
- 'master'
tags:
- 'v*.*.*'

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build rust ${{ matrix.platform.target }}/${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
# mac target
- { os: 'macos-latest', target: 'x86_64-apple-darwin', arch: 'x86_64', osn: 'mac' }
- { os: 'macos-latest', target: 'aarch64-apple-darwin', arch: 'aarch64', osn: 'mac' }
# linux target
- { os: 'ubuntu-latest', target: 'x86_64-unknown-linux-musl', arch: 'x86_64', osn: 'ubuntu-latest' }
- { os: 'ubuntu-latest', target: 'aarch64-unknown-linux-musl', arch: 'aarch64', osn: 'ubuntu-latest' }
steps:
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform.target }}
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.platform.target }} --bin serverdensity_udpserver
- name: mv artifacts
run: |
mkdir -p artifact
mv target/${{ matrix.platform.target }}/release/serverdensity_udpserver artifact/serverdensity_udpserver_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}
- name: Prepare output artifact for next step
uses: actions/upload-artifact@v3
with:
name: serverdensity_udpserver_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}
path: artifact/serverdensity_udpserver_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}

release:
runs-on: 'ubuntu-latest'
needs: [ "build" ]
steps:
- name: download artifacts
uses: actions/download-artifact@v3
with:
path: binaries
- name: install packages
run: |
ls .
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
binaries/*/*

0 comments on commit f6877a7

Please sign in to comment.