github workflow updates

This commit is contained in:
Dethrace Labs 2022-09-16 21:57:50 +12:00
parent 370c7ca480
commit 1ceba81a93
3 changed files with 265 additions and 151 deletions

26
.github/workflows/on_tag.yaml vendored Normal file
View File

@ -0,0 +1,26 @@
name: On Tag
on:
push:
tags:
- '*'
jobs:
create-release:
#needs: [build-linux, build-macos, build-windows]
#if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
# - name: Fetch build artifacts
# uses: actions/download-artifact@v1
# with:
# name: artifacts
- name: Create release
id: create-release
uses: actions/create-release@v1
with:
draft: false
prerelease: false
release_name: ${{ github.ref_name}}
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}

76
.github/workflows/pr.yaml vendored Normal file
View File

@ -0,0 +1,76 @@
name: Pull Request
on: [pull_request]
jobs:
build-linux:
runs-on: ubuntu-18.04
strategy:
matrix:
platform: [gcc]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- name: Build
env:
CC: ${{ steps.vars.outputs.cc }}
CXX: ${{ steps.vars.outputs.cxx }}
MATRIX_PLATFORM: ${{ matrix.platform }}
run: .github/scripts/build-linux.sh
- name: Test
run: |
cd build
ctest --verbose
build-macos:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- name: Build
run: |
.github/scripts/build-macos.sh
- name: Test
run: |
cd build
ctest --verbose
build-windows:
runs-on: windows-2019
strategy:
matrix:
platform: [x86, amd64]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- uses: ilammy/msvc-dev-cmd@v1.4.1
with:
arch: ${{ matrix.platform }}
- name: Build
run: |
.github/scripts/build-msvc.ps1
env:
MATRIX_PLATFORM: ${{ matrix.platform }}
- name: Test
run: |
cd build
ctest --verbose -C RelWithDebInfo

View File

@ -1,158 +1,170 @@
name: Workflow name: Push to main
on: [push, pull_request] on:
push:
branches:
- main
jobs: jobs:
build:
build-linux:
runs-on: ubuntu-18.04
strategy:
matrix:
platform: [gcc]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- name: Build
env:
CC: ${{ steps.vars.outputs.cc }}
CXX: ${{ steps.vars.outputs.cxx }}
MATRIX_PLATFORM: ${{ matrix.platform }}
run: .github/scripts/build-linux.sh
- name: Test
run: |
cd build
ctest --verbose
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v1
with:
name: artifacts
path: linux-amd64.tar.gz
build-macos:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- name: Build
run: |
.github/scripts/build-macos.sh
- name: Test
run: |
cd build
ctest --verbose
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v1
with:
name: artifacts
path: darwin-amd64.tar.gz
build-windows:
runs-on: windows-2019
strategy:
matrix:
platform: [x86, amd64]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- uses: ilammy/msvc-dev-cmd@v1.4.1
with:
arch: ${{ matrix.platform }}
- name: Build
run: |
.github/scripts/build-msvc.ps1
env:
MATRIX_PLATFORM: ${{ matrix.platform }}
- name: Test
run: |
cd build
ctest --verbose -C RelWithDebInfo
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v1
with:
name: artifacts
path: windows-${{ matrix.platform }}.zip
create-release:
needs: [build-linux, build-macos, build-windows]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with: with:
fetch-depth: 0 github_token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Obtain tag version # build-linux:
id: get_version # runs-on: ubuntu-18.04
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} # strategy:
- name: Fetch build artifacts # matrix:
uses: actions/download-artifact@v1 # platform: [gcc]
with: # steps:
name: artifacts # - uses: actions/checkout@v2
- name: Create release # with:
id: create-release # fetch-depth: 0
uses: actions/create-release@v1 # ref: ${{ github.event.pull_request.head.sha }}
with: # - name: Setup Ninja
draft: false # uses: ashutoshvarma/setup-ninja@master
prerelease: true # with:
release_name: ${{ steps.get_version.outputs.VERSION }} # version: 1.10.2
tag_name: ${{ github.ref }} # - name: Build
env: # env:
GITHUB_TOKEN: ${{ github.token }} # CC: ${{ steps.vars.outputs.cc }}
- name: Upload linux-amd64 artifact # CXX: ${{ steps.vars.outputs.cxx }}
uses: actions/upload-release-asset@v1.0.1 # MATRIX_PLATFORM: ${{ matrix.platform }}
env: # run: .github/scripts/build-linux.sh
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - name: Test
with: # run: |
upload_url: ${{ steps.create-release.outputs.upload_url }} # cd build
asset_path: ./artifacts/linux-amd64.tar.gz # ctest --verbose
asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz # - name: Upload artifact
asset_content_type: application/octet-stream # if: startsWith(github.ref, 'refs/tags/')
- name: Upload darwin-amd64 artifact # uses: actions/upload-artifact@v1
uses: actions/upload-release-asset@v1.0.1 # with:
env: # name: artifacts
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # path: linux-amd64.tar.gz
with:
upload_url: ${{ steps.create-release.outputs.upload_url }} # build-macos:
asset_path: ./artifacts/darwin-amd64.tar.gz # runs-on: macos-10.15
asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz # steps:
asset_content_type: application/octet-stream # - uses: actions/checkout@v2
- name: Upload windows-x86 artifact # with:
uses: actions/upload-release-asset@v1.0.1 # fetch-depth: 0
env: # ref: ${{ github.event.pull_request.head.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - name: Setup Ninja
with: # uses: ashutoshvarma/setup-ninja@master
upload_url: ${{ steps.create-release.outputs.upload_url }} # with:
asset_path: ./artifacts/windows-x86.zip # version: 1.10.2
asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-windows-x86.zip # - name: Build
asset_content_type: application/octet-stream # run: |
- name: Upload windows-amd64 artifact # .github/scripts/build-macos.sh
uses: actions/upload-release-asset@v1.0.1 # - name: Test
env: # run: |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # cd build
with: # ctest --verbose
upload_url: ${{ steps.create-release.outputs.upload_url }} # - name: Upload artifact
asset_path: ./artifacts/windows-amd64.zip # if: startsWith(github.ref, 'refs/tags/')
asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-windows-amd64.zip # uses: actions/upload-artifact@v1
asset_content_type: application/octet-stream # with:
# name: artifacts
# path: darwin-amd64.tar.gz
# build-windows:
# runs-on: windows-2019
# strategy:
# matrix:
# platform: [x86, amd64]
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
# ref: ${{ github.event.pull_request.head.sha }}
# - name: Setup Ninja
# uses: ashutoshvarma/setup-ninja@master
# with:
# version: 1.10.2
# - uses: ilammy/msvc-dev-cmd@v1.4.1
# with:
# arch: ${{ matrix.platform }}
# - name: Build
# run: |
# .github/scripts/build-msvc.ps1
# env:
# MATRIX_PLATFORM: ${{ matrix.platform }}
# - name: Test
# run: |
# cd build
# ctest --verbose -C RelWithDebInfo
# - name: Upload artifact
# if: startsWith(github.ref, 'refs/tags/')
# uses: actions/upload-artifact@v1
# with:
# name: artifacts
# path: windows-${{ matrix.platform }}.zip
# create-release:
# needs: [build-linux, build-macos, build-windows]
# if: startsWith(github.ref, 'refs/tags/')
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
# ref: ${{ github.event.pull_request.head.sha }}
# - name: Obtain tag version
# id: get_version
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
# - name: Fetch build artifacts
# uses: actions/download-artifact@v1
# with:
# name: artifacts
# - name: Create release
# id: create-release
# uses: actions/create-release@v1
# with:
# draft: false
# prerelease: true
# release_name: ${{ steps.get_version.outputs.VERSION }}
# tag_name: ${{ github.ref }}
# env:
# GITHUB_TOKEN: ${{ github.token }}
# - name: Upload linux-amd64 artifact
# uses: actions/upload-release-asset@v1.0.1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# asset_path: ./artifacts/linux-amd64.tar.gz
# asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz
# asset_content_type: application/octet-stream
# - name: Upload darwin-amd64 artifact
# uses: actions/upload-release-asset@v1.0.1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# asset_path: ./artifacts/darwin-amd64.tar.gz
# asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz
# asset_content_type: application/octet-stream
# - name: Upload windows-x86 artifact
# uses: actions/upload-release-asset@v1.0.1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# asset_path: ./artifacts/windows-x86.zip
# asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-windows-x86.zip
# asset_content_type: application/octet-stream
# - name: Upload windows-amd64 artifact
# uses: actions/upload-release-asset@v1.0.1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# asset_path: ./artifacts/windows-amd64.zip
# asset_name: dethrace-${{ steps.get_version.outputs.VERSION }}-windows-amd64.zip
# asset_content_type: application/octet-stream