From 4a4d0dad4b4db0ea6e15aa8f7f2824866ae90eea Mon Sep 17 00:00:00 2001 From: daief <1437931235@qq.com> Date: Fri, 20 May 2022 11:46:29 +0800 Subject: [PATCH] chore: merge mapi, test, build to ci.yml & keep release in release.yml --- .github/workflows/{mapi.yml => ci.yml} | 57 +++++++++++++++++++++++--- .github/workflows/release.yml | 32 +++------------ 2 files changed, 56 insertions(+), 33 deletions(-) rename .github/workflows/{mapi.yml => ci.yml} (54%) diff --git a/.github/workflows/mapi.yml b/.github/workflows/ci.yml similarity index 54% rename from .github/workflows/mapi.yml rename to .github/workflows/ci.yml index abd3ba3..b111481 100644 --- a/.github/workflows/mapi.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,38 @@ -name: 'Mayhem for API' - +name: ci on: push: - branches: [master] + branches: [ master ] pull_request: - branches: [master] + branches: [ master ] jobs: test: runs-on: ubuntu-latest - strategy: - fail-fast: true + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.18 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: go get + + - name: Unit Tests + run: go test ./... -run ./... + + - name: API Tests + run: | + npm -g install newman + ./testing/run_api_tests.sh + + mapi: + name: 'Mayhem for API' + runs-on: ubuntu-latest steps: - name: Set up Go 1.x uses: actions/setup-go@v2 @@ -50,3 +72,26 @@ jobs: uses: github/codeql-action/upload-sarif@v1 with: sarif_file: mapi.sarif + + build: + strategy: + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.platform }} + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.18 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: go get + + - name: Build + run: go build -v . \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5c4455..b73e788 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,13 @@ name: Release on: - push: - branches: - pull_request: release: types: - published jobs: - build-and-release: - name: Build & Release + release: + name: Release strategy: fail-fast: false matrix: @@ -36,20 +33,7 @@ jobs: uses: actions/checkout@v2 - name: Get dependencies - run: | - go get - - - name: Enable Go 1.11 modules - if: runner.os == 'Windows' - run: cmd /c "set GO111MODULE=on" - - - name: Unit Tests - run: go test ./... -run ./... - - - name: API Tests - run: | - npm -g install newman - ./testing/run_api_tests.sh + run: go get - name: Build run: go build -v . @@ -66,12 +50,6 @@ jobs: zip -9 release.zip wakapi config.yml - name: Upload built executable to Release - if: github.event_name == 'release' - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v1 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: release.zip - asset_name: wakapi_${{ matrix.alias }}_amd64.zip - asset_content_type: application/gzip + files: wakapi_${{ matrix.alias }}_amd64.zip