mirror of https://github.com/Aloxaf/silicon
chore: use github actions to release
This commit is contained in:
parent
d394052d22
commit
b6b0d8fab6
|
@ -0,0 +1,118 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
name: Release
|
||||
|
||||
jobs:
|
||||
create_release:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
release-linux:
|
||||
name: x86_64-unknown-linux-gnu
|
||||
needs: create_release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libx11-xcb-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --release
|
||||
- id: get_name
|
||||
run: |
|
||||
echo ::set-output name=NAME::silicon-${GITHUB_REF/refs\/tags\//}-x86_64-unknown-linux-gnu.tar.xz
|
||||
- run: |
|
||||
tar czf ${{ steps.get_name.outputs.NAME }} ./target/release/silicon
|
||||
- uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: ./${{ steps.get_name.outputs.NAME }}
|
||||
asset_name: ${{ steps.get_name.outputs.NAME }}
|
||||
asset_content_type: application/zip
|
||||
|
||||
release-macos:
|
||||
name: x86_64-apple-darwin
|
||||
needs: create_release
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --release
|
||||
- id: get_name
|
||||
run: |
|
||||
echo ::set-output name=NAME::silicon-${GITHUB_REF/refs\/tags\//}-x86_64-apple-darwin.tar.xz
|
||||
- run: |
|
||||
tar czf ${{ steps.get_name.outputs.NAME }} ./target/release/silicon
|
||||
- uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: ./${{ steps.get_name.outputs.NAME }}
|
||||
asset_name: ${{ steps.get_name.outputs.NAME }}
|
||||
asset_content_type: application/zip
|
||||
|
||||
release-windows:
|
||||
name: x86_64-pc-windows-gnu
|
||||
needs: create_release
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [x86_64-pc-windows-gnu]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: ${{ matrix.target }}
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: true
|
||||
command: build
|
||||
args: --release --target ${{ matrix.target }}
|
||||
- id: get_name
|
||||
run: |
|
||||
echo ::set-output name=NAME::silicon-${GITHUB_REF/refs\/tags\//}-${{ matrix.target }}.tar.xz
|
||||
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
||||
- run: |
|
||||
shopt -s extglob
|
||||
tar czf ${{ steps.get_name.outputs.NAME }} ./target/${{ matrix.target }}/release/silicon?(|.exe)
|
||||
- uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: ./${{ steps.get_name.outputs.NAME }}
|
||||
asset_name: ${{ steps.get_name.outputs.NAME }}
|
||||
asset_content_type: application/zip
|
80
.travis.yml
80
.travis.yml
|
@ -1,80 +0,0 @@
|
|||
# Based on the "trust" template v0.1.2
|
||||
# https://github.com/japaric/trust/tree/v0.1.2
|
||||
|
||||
dist: xenial
|
||||
language: rust
|
||||
services: docker
|
||||
sudo: required
|
||||
|
||||
env:
|
||||
global:
|
||||
- CRATE_NAME=silicon
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libx11-xcb-dev
|
||||
- libxcb-shape0-dev
|
||||
- libxcb-xfixes0-dev
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Linux
|
||||
- env: TARGET=x86_64-unknown-linux-gnu
|
||||
|
||||
# OSX
|
||||
- env: TARGET=x86_64-apple-darwin
|
||||
os: osx
|
||||
|
||||
# Testing other channels
|
||||
- env: TARGET=x86_64-unknown-linux-gnu
|
||||
rust: nightly
|
||||
|
||||
- env: TARGET=x86_64-unknown-linux-gnu
|
||||
rust: beta
|
||||
|
||||
before_install:
|
||||
- set -e
|
||||
- rustup self update
|
||||
|
||||
install:
|
||||
- bash ci/install.sh
|
||||
- source ~/.cargo/env || true
|
||||
|
||||
script:
|
||||
- bash ci/script.sh
|
||||
|
||||
after_script: set +e
|
||||
|
||||
before_deploy:
|
||||
- bash ci/before_deploy.sh
|
||||
|
||||
deploy:
|
||||
api_key:
|
||||
secure: bwUsR03KCY3xswAbZzKaUEvR2G3kOm9lhZA0uHZdm3bx6vLSsq0zuwBoS3Cp60ACyZHYNej3Kt4SajZYloLbfoKJppV26qfE2Dd6f5EtHRnIEi3WY8d74ZUDUAjy4uGoC6N8nRiKrxuJhyUvGXz2kqDbCcwGXxuCEvodfJ7TaqOVOzEhpGC9G5zRokhyzzbgwXxFomD6ewGfQF7D95OgoiRFw1wGADlUM3h4WwQW8VYPDAtXbdQ2k7qZ2EyZEPz4oXfLqQ1saYfwWHztqzfZBvSs9gFNfQfZ8CquLKPV6vtS0BXvzGXbDTYr2Pj752owkvGZ1eEYFVz2kq9dJbIUYk0m/Me3qwNu8YfGPFW+g98X4eByyLkwWYJhKn83SPckgKwIve3j6ivSYNujg8cUc4DLEEK/dbo1FQ5qmmRLwzBjCxT3pQ9qZArA5+K+7dPfTBpC3VLrrW07fRNwoYvT4cxgtDTz15q8d7Vz65fo1mS1/RnHAGmSVXVa/CdPE43gsSjwuLWpzHoDl3jBVo37QyvPbBL2EeHUf456yzSaOLHaVn9K8E4DbtCltUaXU8eekzKzPpKb/eJQnt0k9WjAtHvXbsJjP1yTKzTFFJ6mHPxQHKyRB6Tugmou0OVcsT7RRTahaWTl2hmitY9yQHqEwYBQ+RlcdBHcokXhu6Y2gv4=
|
||||
file_glob: true
|
||||
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
|
||||
on:
|
||||
condition: $TRAVIS_RUST_VERSION = stable
|
||||
tags: true
|
||||
provider: releases
|
||||
skip_cleanup: true
|
||||
|
||||
cache: cargo
|
||||
before_cache:
|
||||
# Travis can't cache files that are not readable by "others"
|
||||
- chmod -R a+r $HOME/.cargo
|
||||
|
||||
branches:
|
||||
only:
|
||||
# release tags
|
||||
- /^v\d+\.\d+\.\d+.*$/
|
||||
- master
|
||||
# This is where pull requests from "bors r+" are built.
|
||||
- staging
|
||||
# This is where pull requests from "bors try" are built.
|
||||
- trying
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
|
@ -3,8 +3,6 @@
|
|||
[![Crates.io](https://img.shields.io/crates/v/silicon.svg)](https://crates.io/crates/silicon)
|
||||
[![Documentation](https://docs.rs/silicon/badge.svg)](https://docs.rs/silicon)
|
||||
[![CI](https://github.com/Aloxaf/silicon/workflows/CI/badge.svg)](https://github.com/Aloxaf/silicon/actions?query=workflow%3ACI)
|
||||
[![Linux Build Status](https://travis-ci.org/Aloxaf/silicon.svg?branch=master)](https://travis-ci.org/Aloxaf/silicon)
|
||||
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/Aloxaf/silicon?svg=true)](https://ci.appveyor.com/project/Aloxaf/silicon)
|
||||
![License](https://img.shields.io/crates/l/silicon.svg)
|
||||
|
||||
Silicon is an alternative to [Carbon](https://github.com/dawnlabs/carbon) implemented in Rust.
|
||||
|
|
77
appveyor.yml
77
appveyor.yml
|
@ -1,77 +0,0 @@
|
|||
# Based on the "trust" template v0.1.2
|
||||
# https://github.com/japaric/trust/tree/v0.1.2
|
||||
|
||||
environment:
|
||||
global:
|
||||
RUST_VERSION: stable
|
||||
|
||||
CRATE_NAME: silicon
|
||||
|
||||
matrix:
|
||||
# https://github.com/rust-lang/rust/issues/47048
|
||||
# MinGW
|
||||
# - TARGET: x86_64-pc-windows-gnu
|
||||
|
||||
# MSVC
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
|
||||
# Testing other channels
|
||||
# - TARGET: x86_64-pc-windows-gnu
|
||||
# RUST_VERSION: nightly
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
RUST_VERSION: nightly
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
RUST_VERSION: beta
|
||||
|
||||
install:
|
||||
- ps: >-
|
||||
If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') {
|
||||
$Env:PATH += ';C:\msys64\mingw64\bin'
|
||||
} ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') {
|
||||
$Env:PATH += ';C:\msys64\mingw32\bin'
|
||||
}
|
||||
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
|
||||
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- rustc -Vv
|
||||
- cargo -V
|
||||
|
||||
test_script:
|
||||
# we don't run the "test phase" when doing deploys
|
||||
- if [%APPVEYOR_REPO_TAG%]==[false] (
|
||||
cargo build --target %TARGET% &&
|
||||
cargo build --target %TARGET% --release &&
|
||||
cargo test --target %TARGET% &&
|
||||
cargo test --target %TARGET% --release
|
||||
)
|
||||
|
||||
before_deploy:
|
||||
- cargo rustc --target %TARGET% --release --bin silicon -- -C lto
|
||||
- ps: ci\before_deploy.ps1
|
||||
|
||||
deploy:
|
||||
artifact: /.*\.zip/
|
||||
auth_token:
|
||||
secure: epmu1iKLq1xQP+5V+CK1iVUo+Dw82agICfMCvPVAcFnkE8e5/O4SaryNJxqPkyd4
|
||||
description: ''
|
||||
on:
|
||||
RUST_VERSION: stable
|
||||
appveyor_repo_tag: true
|
||||
provider: GitHub
|
||||
|
||||
cache:
|
||||
- C:\Users\appveyor\.cargo\registry
|
||||
- target
|
||||
|
||||
branches:
|
||||
only:
|
||||
# Release tags
|
||||
- /^v\d+\.\d+\.\d+.*$/
|
||||
- master
|
||||
|
||||
notifications:
|
||||
- provider: Email
|
||||
on_build_success: false
|
||||
|
||||
# Building is done in the test phase, so we disable Appveyor's build phase.
|
||||
build: false
|
|
@ -1,22 +0,0 @@
|
|||
# This script takes care of packaging the build artifacts that will go in the
|
||||
# release zipfile
|
||||
|
||||
$SRC_DIR = $PWD.Path
|
||||
$STAGE = [System.Guid]::NewGuid().ToString()
|
||||
|
||||
Set-Location $ENV:Temp
|
||||
New-Item -Type Directory -Name $STAGE
|
||||
Set-Location $STAGE
|
||||
|
||||
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
|
||||
|
||||
Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\silicon.exe" '.\'
|
||||
|
||||
7z a "$ZIP" *
|
||||
|
||||
Push-AppveyorArtifact "$ZIP"
|
||||
|
||||
Remove-Item *.* -Force
|
||||
Set-Location ..
|
||||
Remove-Item $STAGE
|
||||
Set-Location $SRC_DIR
|
|
@ -1,37 +0,0 @@
|
|||
# This script takes care of building your crate and packaging it for release
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
local src=$(pwd) \
|
||||
stage=
|
||||
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux)
|
||||
stage=$(mktemp -d)
|
||||
;;
|
||||
osx)
|
||||
stage=$(mktemp -d -t tmp)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -f Cargo.lock || cargo generate-lockfile
|
||||
|
||||
if [ $TARGET == "x86_64-unknown-linux-gnu" ]; then
|
||||
CARGO=cargo
|
||||
else
|
||||
CARGO=cross
|
||||
fi
|
||||
|
||||
$CARGO rustc --bin silicon --target $TARGET --release -- -C lto
|
||||
|
||||
cp target/$TARGET/release/silicon $stage/
|
||||
|
||||
cd $stage
|
||||
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
|
||||
cd $src
|
||||
|
||||
rm -rf $stage
|
||||
}
|
||||
|
||||
main
|
|
@ -1,47 +0,0 @@
|
|||
set -ex
|
||||
|
||||
main() {
|
||||
local target=
|
||||
if [ $TRAVIS_OS_NAME = linux ]; then
|
||||
target=x86_64-unknown-linux-musl
|
||||
sort=sort
|
||||
else
|
||||
target=x86_64-apple-darwin
|
||||
sort=gsort # for `sort --sort-version`, from brew's coreutils.
|
||||
fi
|
||||
|
||||
# Builds for iOS are done on OSX, but require the specific target to be
|
||||
# installed.
|
||||
case $TARGET in
|
||||
aarch64-apple-ios)
|
||||
rustup target install aarch64-apple-ios
|
||||
;;
|
||||
armv7-apple-ios)
|
||||
rustup target install armv7-apple-ios
|
||||
;;
|
||||
armv7s-apple-ios)
|
||||
rustup target install armv7s-apple-ios
|
||||
;;
|
||||
i386-apple-ios)
|
||||
rustup target install i386-apple-ios
|
||||
;;
|
||||
x86_64-apple-ios)
|
||||
rustup target install x86_64-apple-ios
|
||||
;;
|
||||
esac
|
||||
|
||||
# This fetches latest stable release
|
||||
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
|
||||
| cut -d/ -f3 \
|
||||
| grep -E '^v[0.1.0-9.]+$' \
|
||||
| $sort --version-sort \
|
||||
| tail -n1)
|
||||
curl -LSfs https://japaric.github.io/trust/install.sh | \
|
||||
sh -s -- \
|
||||
--force \
|
||||
--git japaric/cross \
|
||||
--tag $tag \
|
||||
--target $target
|
||||
}
|
||||
|
||||
main
|
29
ci/script.sh
29
ci/script.sh
|
@ -1,29 +0,0 @@
|
|||
# This script takes care of testing your crate
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
if [ $TARGET == "x86_64-unknown-linux-gnu" ]; then
|
||||
CARGO=cargo
|
||||
else
|
||||
CARGO=cross
|
||||
fi
|
||||
|
||||
$CARGO build --target $TARGET
|
||||
$CARGO build --target $TARGET --release
|
||||
|
||||
if [ ! -z $DISABLE_TESTS ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
$CARGO test --target $TARGET
|
||||
$CARGO test --target $TARGET --release
|
||||
|
||||
# cross run --target $TARGET
|
||||
# cross run --target $TARGET --release
|
||||
}
|
||||
|
||||
# we don't run the "test phase" when doing deploys
|
||||
if [ -z $TRAVIS_TAG ]; then
|
||||
main
|
||||
fi
|
Loading…
Reference in New Issue