Merge pull request #130 from radu-matei/disable-xplat-builds

This commit is contained in:
Radu Matei 2022-03-05 17:03:13 +02:00 committed by GitHub
commit e5857df73b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 148 additions and 140 deletions

View File

@ -1,152 +1,160 @@
name: Release
on:
push:
branches:
- main
tags:
- "v*"
# TODO
#
# Temporarily disabling this workflow since macOS workers consume 10x as many
# CI minutes as Linux workers, which made us consume the included minutes for this
# month.
#
# Once the project is public, we can just uncomment this and re-add this workflow.
jobs:
build:
name: build release assets
runs-on: ${{ matrix.config.os }}
env: ${{ matrix.config.env }}
strategy:
matrix:
config:
- {
os: "ubuntu-latest",
arch: "amd64",
extension: "",
extraArgs: "",
target: "",
targetDir: "target/release",
env: {},
}
- {
os: "ubuntu-latest",
arch: "aarch64",
extension: "",
extraArgs: "--target aarch64-unknown-linux-gnu",
target: "aarch64-unknown-linux-gnu",
targetDir: "target/aarch64-unknown-linux-gnu/release",
env: { OPENSSL_DIR: "/usr/local/openssl-aarch64" },
}
- {
os: "macos-latest",
arch: "amd64",
extension: "",
extraArgs: "",
target: "",
targetDir: "target/release",
env: {},
}
- {
os: "macos-latest",
arch: "aarch64",
extension: "",
extraArgs: "--target aarch64-apple-darwin",
target: "aarch64-apple-darwin",
targetDir: "target/aarch64-apple-darwin/release/",
env: { OPENSSL_DIR: "/usr/local/openssl-aarch64" },
}
- {
os: "windows-latest",
arch: "amd64",
extension: ".exe",
extraArgs: "",
target: "",
targetDir: "target/release",
env: {},
}
steps:
- uses: actions/checkout@v2
# name: Release
# on:
# push:
# branches:
# - main
# tags:
# - "v*"
- name: set the release version (tag)
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
# jobs:
# build:
# name: build release assets
# runs-on: ${{ matrix.config.os }}
# env: ${{ matrix.config.env }}
# strategy:
# matrix:
# config:
# - {
# os: "ubuntu-latest",
# arch: "amd64",
# extension: "",
# extraArgs: "",
# target: "",
# targetDir: "target/release",
# env: {},
# }
# - {
# os: "ubuntu-latest",
# arch: "aarch64",
# extension: "",
# extraArgs: "--target aarch64-unknown-linux-gnu",
# target: "aarch64-unknown-linux-gnu",
# targetDir: "target/aarch64-unknown-linux-gnu/release",
# env: { OPENSSL_DIR: "/usr/local/openssl-aarch64" },
# }
# - {
# os: "macos-latest",
# arch: "amd64",
# extension: "",
# extraArgs: "",
# target: "",
# targetDir: "target/release",
# env: {},
# }
# - {
# os: "macos-latest",
# arch: "aarch64",
# extension: "",
# extraArgs: "--target aarch64-apple-darwin",
# target: "aarch64-apple-darwin",
# targetDir: "target/aarch64-apple-darwin/release/",
# env: { OPENSSL_DIR: "/usr/local/openssl-aarch64" },
# }
# - {
# os: "windows-latest",
# arch: "amd64",
# extension: ".exe",
# extraArgs: "",
# target: "",
# targetDir: "target/release",
# env: {},
# }
# steps:
# - uses: actions/checkout@v2
- name: set the release version (main)
if: github.ref == 'refs/heads/main'
shell: bash
run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV
# - name: set the release version (tag)
# if: startsWith(github.ref, 'refs/tags/v')
# shell: bash
# run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: lowercase the runner OS name
shell: bash
run: |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
echo "RUNNER_OS=$OS" >> $GITHUB_ENV
# - name: set the release version (main)
# if: github.ref == 'refs/heads/main'
# shell: bash
# run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV
- name: "Install Wasm Rust targets"
run: |
rustup target add wasm32-wasi
rustup target add wasm32-unknown-unknown
# - name: lowercase the runner OS name
# shell: bash
# run: |
# OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
# echo "RUNNER_OS=$OS" >> $GITHUB_ENV
- name: Install latest Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
target: ${{ matrix.config.target }}
# - name: "Install Wasm Rust targets"
# run: |
# rustup target add wasm32-wasi
# rustup target add wasm32-unknown-unknown
- name: setup for cross-compiled linux aarch64 build
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
cd /tmp
git clone https://github.com/openssl/openssl
cd openssl
git checkout OpenSSL_1_1_1l
sudo mkdir -p $OPENSSL_DIR
./Configure linux-aarch64 --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared
make CC=aarch64-linux-gnu-gcc
sudo make install
echo '[target.aarch64-unknown-linux-gnu]' >> ${HOME}/.cargo/config.toml
echo 'linker = "aarch64-linux-gnu-gcc"' >> ${HOME}/.cargo/config.toml
# - name: Install latest Rust stable toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# default: true
# target: ${{ matrix.config.target }}
- name: setup for cross-compiled darwin aarch64 build
if: matrix.config.target == 'aarch64-apple-darwin'
run: |
cd /tmp
git clone https://github.com/openssl/openssl
cd openssl
git checkout OpenSSL_1_1_1l
sudo mkdir -p $OPENSSL_DIR
./Configure enable-rc5 zlib darwin64-arm64-cc no-asm --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared
sudo make install
# - name: setup for cross-compiled linux aarch64 build
# if: matrix.config.target == 'aarch64-unknown-linux-gnu'
# run: |
# sudo apt update
# sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
# cd /tmp
# git clone https://github.com/openssl/openssl
# cd openssl
# git checkout OpenSSL_1_1_1l
# sudo mkdir -p $OPENSSL_DIR
# ./Configure linux-aarch64 --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared
# make CC=aarch64-linux-gnu-gcc
# sudo make install
# echo '[target.aarch64-unknown-linux-gnu]' >> ${HOME}/.cargo/config.toml
# echo 'linker = "aarch64-linux-gnu-gcc"' >> ${HOME}/.cargo/config.toml
- name: build release
uses: actions-rs/cargo@v1
with:
command: build
args: "--all-features --release ${{ matrix.config.extraArgs }}"
# - name: setup for cross-compiled darwin aarch64 build
# if: matrix.config.target == 'aarch64-apple-darwin'
# run: |
# cd /tmp
# git clone https://github.com/openssl/openssl
# cd openssl
# git checkout OpenSSL_1_1_1l
# sudo mkdir -p $OPENSSL_DIR
# ./Configure enable-rc5 zlib darwin64-arm64-cc no-asm --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared
# sudo make install
- name: package release assets
shell: bash
run: |
mkdir _dist
cp readme.md LICENSE ${{ matrix.config.targetDir }}/spin${{ matrix.config.extension }} _dist/
cd _dist
tar czf spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz readme.md LICENSE spin${{ matrix.config.extension }}
# - name: build release
# uses: actions-rs/cargo@v1
# with:
# command: build
# args: "--all-features --release ${{ matrix.config.extraArgs }}"
- name: upload binary as GitHub artifact
uses: actions/upload-artifact@v1
with:
name: spin
path: _dist/spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
# - name: package release assets
# shell: bash
# run: |
# mkdir _dist
# cp readme.md LICENSE ${{ matrix.config.targetDir }}/spin${{ matrix.config.extension }} _dist/
# cd _dist
# tar czf spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz readme.md LICENSE spin${{ matrix.config.extension }}
- name: upload binary to canary GitHub release
uses: svenstaro/upload-release-action@2.2.1
if: github.ref == 'refs/heads/main'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: _dist/spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
asset_name: spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
tag: canary
overwrite: true
prerelease: true
body: |
This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.
It is only intended for developers wishing to try out the latest features in Spin, some of which may not be fully implemented.
# - name: upload binary as GitHub artifact
# uses: actions/upload-artifact@v1
# with:
# name: spin
# path: _dist/spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
# - name: upload binary to canary GitHub release
# uses: svenstaro/upload-release-action@2.2.1
# if: github.ref == 'refs/heads/main'
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: _dist/spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
# asset_name: spin-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
# tag: canary
# overwrite: true
# prerelease: true
# body: |
# This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.
# It is only intended for developers wishing to try out the latest features in Spin, some of which may not be fully implemented.