build.yml 2.1 KB
Newer Older
H
hiCasper 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
name: Build

on:
  push:
    branches: [ master ]

jobs:

  test:
    name: Test
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go 1.13
      uses: actions/setup-go@v1
      with:
        go-version: 1.13
      id: go

    - name: Check out code into the Go module directory
      uses: actions/checkout@v2
      with:
        submodules: 'recursive'

    - name: Get dependencies
      run: |
        go get github.com/rakyll/statik
        export PATH=$PATH:~/go/bin/
        statik -src=models -f

    - name: Test
      run: go test -coverprofile=coverage.txt -covermode=atomic ./...

  build:
    name: Build
    needs: test
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go 1.13
      uses: actions/setup-go@v1
      with:
        go-version: 1.13
      id: go

    - name: Check out code into the Go module directory
      uses: actions/checkout@v2
      with:
49
        clean: false
H
hiCasper 已提交
50
        submodules: 'recursive'
51 52
    - run: |
        git fetch --prune --unshallow --tags
H
hiCasper 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65

    - name: Get dependencies and build
      run: |
        go get github.com/rakyll/statik
        export PATH=$PATH:~/go/bin/
        statik -src=models -f
        sudo apt-get update
        sudo apt-get -y install gcc-mingw-w64-x86-64
        sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
        sudo apt-get -y install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
        chmod +x ./build.sh
        ./build.sh -r b

H
hiCasper 已提交
66 67
    - name: Upload binary files (windows_amd64)
      uses: actions/upload-artifact@v2
H
hiCasper 已提交
68
      with:
H
hiCasper 已提交
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
        name: cloudreve_windows_amd64
        path: release/cloudreve*windows_amd64.*

    - name: Upload binary files (linux_amd64)
      uses: actions/upload-artifact@v2
      with:
        name: cloudreve_linux_amd64
        path: release/cloudreve*linux_amd64.*

    - name: Upload binary files (linux_arm)
      uses: actions/upload-artifact@v2
      with:
        name: cloudreve_linux_arm
        path: release/cloudreve*linux_arm.*

    - name: Upload binary files (linux_arm64)
      uses: actions/upload-artifact@v2
      with:
        name: cloudreve_linux_arm64
        path: release/cloudreve*linux_arm64.*