Skip to content

add windows and macos ci #89

add windows and macos ci

add windows and macos ci #89

Workflow file for this run

name: CI
on:
push:
branches:
- release*
tags:
- v*
- nightly
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- main
paths-ignore:
- '**/*.md'
labels:
- linux
jobs:
build-x86_64:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install
shell: bash
run: scripts/install.sh local-install
- name: Pack
shell: bash
run: scripts/pack.sh home-cli-x86_64.tar
- uses: actions/upload-artifact@v3
with:
name: home-cli-pack-x86_64
path: home-cli-x86_64.tar
run-x86_64:
runs-on: ubuntu-20.04
needs: build-x86_64
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-x86_64
- name: Unpack
shell: bash
run: scripts/install.sh unpack home-cli-x86_64.tar
build-arm64:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: uraimo/run-on-arch-action@v2
name: Run commands
with:
arch: aarch64
distro: ubuntu20.04
# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}:/workspace"
env: |
HOMECLI_PRINT_PROGRESS: false
install: |
apt update -y
apt install -y python3 python3-pip curl libfuse-dev git
# Set an output parameter `uname` for use in subsequent steps
run: |
uname -a
cd /workspace
scripts/install.sh local-install
scripts/pack.sh home-cli-arm64.tar
- uses: actions/upload-artifact@v3
with:
name: home-cli-pack-arm64
path: home-cli-arm64.tar
run-arm64:
runs-on: ubuntu-20.04
needs: build-arm64
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-arm64
- uses: uraimo/run-on-arch-action@v2
name: Run commands
with:
arch: aarch64
distro: ubuntu20.04
env: |
HOMECLI_PRINT_PROGRESS: false
# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}:/workspace"
install: |
apt update -y
apt install -y python3 python3-pip curl libfuse-dev git
# Set an output parameter `uname` for use in subsequent steps
run: |
cd /workspace
scripts/install.sh unpack home-cli-arm64.tar
release:
runs-on: ubuntu-20.04
needs:
- run-x86_64
- run-arm64
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- name: Create Release
if: "!contains(github.ref, 'nightly')"
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete Legacy Pre-Release
if: "contains(github.ref, 'nightly')"
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: releases } = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
for (const release of releases) {
if (release.prerelease) {
await github.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
});
}
}
- name: Create Pre-Release
if: contains(github.ref, 'nightly')
id: create_pre_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Pre-Release
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-x86_64
- name: Upload Assets x86_64
if: "!contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./home-cli-x86_64.tar
asset_name: home-cli-x86_64.tar
asset_content_type: application/tar
- name: Upload Pre-Release Assets x86_64
if: contains(github.ref, 'nightly')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./home-cli-x86_64.tar
asset_name: home-cli-x86_64.tar
asset_content_type: application/tar
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-arm64
- name: Upload Assets arm64
if: "!contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./home-cli-arm64.tar
asset_name: home-cli-arm64.tar
asset_content_type: application/tar
- name: Upload Pre-Release Assets arm64
if: contains(github.ref, 'nightly')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./home-cli-arm64.tar
asset_name: home-cli-arm64.tar
asset_content_type: application/tar
- name: Upload Assets install.sh
if: "!contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./scripts/install.sh
asset_name: install.sh
asset_content_type: text/plain
- name: Upload Pre-Release Assets install.sh
if: "contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./scripts/install.sh
asset_name: install.sh
asset_content_type: text/plain