mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
Try create release with github action
This commit is contained in:
parent
405a90a0d1
commit
4d83fd7c58
147
.github/workflows/build.yml
vendored
147
.github/workflows/build.yml
vendored
@ -3,101 +3,154 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [master]
|
||||||
jobs:
|
jobs:
|
||||||
|
create-release:
|
||||||
|
name: Create release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
steps:
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: Release ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
build:
|
build:
|
||||||
name: Build-Linux
|
name: Build-${{ matrix.os }}
|
||||||
|
needs: create-release
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
GOARCH: [amd64]
|
os:
|
||||||
runs-on: ubuntu-latest
|
- windows-latest
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-latest
|
||||||
|
GOARCH:
|
||||||
|
- amd64
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.14
|
- name: Set up Go 1.14
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.14
|
go-version: 1.14
|
||||||
- uses: actions/checkout@v2
|
- name: Check out
|
||||||
- run: git fetch --prune --unshallow --tags
|
uses: actions/checkout@v2
|
||||||
|
- name: Get git tag ref
|
||||||
|
run: git fetch --prune --unshallow --tags
|
||||||
|
- name: Restore Cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: go mod download
|
run: go mod download
|
||||||
|
|
||||||
- name: Build on Linux
|
- name: Build on Linux
|
||||||
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
env:
|
env:
|
||||||
GOOS: linux
|
|
||||||
GOARCH: ${{ matrix.GOARCH }}
|
GOARCH: ${{ matrix.GOARCH }}
|
||||||
run: |
|
run: |
|
||||||
go generate ./cmd/executorserver
|
go generate ./cmd/executorserver
|
||||||
go build -o executorserver ./cmd/executorserver
|
go build -o executorserver ./cmd/executorserver
|
||||||
- name: Build shared objects
|
- name: Build shared objects on Linux
|
||||||
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
env:
|
env:
|
||||||
GOOS: linux
|
|
||||||
GOARCH: ${{ matrix.GOARCH }}
|
GOARCH: ${{ matrix.GOARCH }}
|
||||||
run: |
|
run: |
|
||||||
go build -o cinit ./cmd/cinit
|
go build -o cinit ./cmd/cinit
|
||||||
go build -buildmode=c-shared -o executorserver.so ./cmd/ffi
|
go build -buildmode=c-shared -o executorserver.so ./cmd/ffi
|
||||||
- name: Upload executorserver
|
- name: Upload executorserver on linux
|
||||||
uses: actions/upload-artifact@master
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ExecutorServer-${{ matrix.GOARCH }}
|
name: ExecutorServer-${{ matrix.GOARCH }}
|
||||||
path: executorserver
|
path: executorserver
|
||||||
- name: Upload cinit
|
- name: Upload cinit on linux
|
||||||
uses: actions/upload-artifact@master
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: cinit-${{ matrix.GOARCH }}
|
name: cinit-${{ matrix.GOARCH }}
|
||||||
path: cinit
|
path: cinit
|
||||||
- name: Upload executorserver.so
|
- name: Upload executorserver.so on linux
|
||||||
uses: actions/upload-artifact@master
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ExecutorServer-${{ matrix.GOARCH }}.so
|
name: ExecutorServer-${{ matrix.GOARCH }}.so
|
||||||
path: executorserver.so
|
path: executorserver.so
|
||||||
build-windows:
|
- name: Upload assets for linux
|
||||||
name: Build-Windows
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
runs-on: windows-latest
|
uses: actions/upload-release-asset@v1
|
||||||
steps:
|
env:
|
||||||
- name: Set up Go 1.14
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.14
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
- uses: actions/checkout@v2
|
asset_path: executorserver
|
||||||
- run: git fetch --prune --unshallow --tags
|
asset_name: executorserver-${{ matrix.GOARCH }}
|
||||||
- name: Download dependencies
|
asset_content_type: application/octet-stream
|
||||||
run: go mod download
|
|
||||||
- name: Build on Windows
|
- name: Build on Windows
|
||||||
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
|
env:
|
||||||
|
GOARCH: ${{ matrix.GOARCH }}
|
||||||
run: |
|
run: |
|
||||||
go generate ./cmd/executorserver
|
go generate ./cmd/executorserver
|
||||||
go build -o executorserver.exe ./cmd/executorserver
|
go build -o executorserver.exe ./cmd/executorserver
|
||||||
go build -buildmode=c-shared -o executorserver.dll ./cmd/ffi
|
go build -buildmode=c-shared -o executorserver.dll ./cmd/ffi
|
||||||
- name: Upload executorserver.exe on Windows
|
- name: Upload executorserver.exe on Windows
|
||||||
uses: actions/upload-artifact@master
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ExecutorServer.exe
|
name: ExecutorServer-${{ matrix.GOARCH }}.exe
|
||||||
path: executorserver.exe
|
path: executorserver.exe
|
||||||
- name: Upload executorserver.dll on Windows
|
- name: Upload executorserver.dll on Windows
|
||||||
uses: actions/upload-artifact@master
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ExecutorServer.dll
|
name: ExecutorServer-${{ matrix.GOARCH }}.dll
|
||||||
path: executorserver.dll
|
path: executorserver.dll
|
||||||
build-macos:
|
- name: Upload assets for windows
|
||||||
name: Build macOS
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
runs-on: macos-latest
|
uses: actions/upload-release-asset@v1
|
||||||
steps:
|
env:
|
||||||
- name: Set up Go 1.14
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.14
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
- uses: actions/checkout@v2
|
asset_path: executorserver.exe
|
||||||
- run: git fetch --prune --unshallow --tags
|
asset_name: executorserver-${{ matrix.GOARCH }}.exe
|
||||||
- name: Download dependencies
|
asset_content_type: application/octet-stream
|
||||||
run: go mod download
|
|
||||||
- name: Build on MacOS
|
- name: Build on macOS
|
||||||
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
env:
|
||||||
|
GOARCH: ${{ matrix.GOARCH }}
|
||||||
run: |
|
run: |
|
||||||
go generate ./cmd/executorserver
|
go generate ./cmd/executorserver
|
||||||
go build -o executorserver ./cmd/executorserver
|
go build -o executorserver ./cmd/executorserver
|
||||||
go build -buildmode=c-shared -o executorserver.dylib ./cmd/ffi
|
go build -buildmode=c-shared -o executorserver.dylib ./cmd/ffi
|
||||||
- name: Upload executorserver
|
- name: Upload executorserver on macOS
|
||||||
uses: actions/upload-artifact@master
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ExecutorServer-MacOS
|
name: ExecutorServer-MacOS-${{ matrix.GOARCH }}
|
||||||
path: executorserver
|
path: executorserver
|
||||||
- name: Upload executorserver.so
|
- name: Upload executorserver.dylib on macOS
|
||||||
uses: actions/upload-artifact@master
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ExecutorServer.dylib
|
name: ExecutorServer-${{ matrix.GOARCH }}.dylib
|
||||||
path: executorserver.dylib
|
path: executorserver.dylib
|
||||||
|
- name: Upload assets for macOS
|
||||||
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
|
asset_path: executorserver
|
||||||
|
asset_name: executorserver-macOS-${{ matrix.GOARCH }}
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user