1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: merge mapi, test, build to ci.yml & keep release in release.yml

This commit is contained in:
daief 2022-05-20 11:46:29 +08:00
parent 3b87511f48
commit 4a4d0dad4b
2 changed files with 56 additions and 33 deletions

View File

@ -1,16 +1,38 @@
name: 'Mayhem for API' name: ci
on: on:
push: push:
branches: [master] branches: [ master ]
pull_request: pull_request:
branches: [master] branches: [ master ]
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: steps:
fail-fast: true
- 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: steps:
- name: Set up Go 1.x - name: Set up Go 1.x
uses: actions/setup-go@v2 uses: actions/setup-go@v2
@ -50,3 +72,26 @@ jobs:
uses: github/codeql-action/upload-sarif@v1 uses: github/codeql-action/upload-sarif@v1
with: with:
sarif_file: mapi.sarif 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 .

View File

@ -1,16 +1,13 @@
name: Release name: Release
on: on:
push:
branches:
pull_request:
release: release:
types: types:
- published - published
jobs: jobs:
build-and-release: release:
name: Build & Release name: Release
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -36,20 +33,7 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Get dependencies - name: Get dependencies
run: | run: go get
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
- name: Build - name: Build
run: go build -v . run: go build -v .
@ -66,12 +50,6 @@ jobs:
zip -9 release.zip wakapi config.yml zip -9 release.zip wakapi config.yml
- name: Upload built executable to Release - name: Upload built executable to Release
if: github.event_name == 'release' uses: softprops/action-gh-release@v1
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ github.event.release.upload_url }} files: wakapi_${{ matrix.alias }}_amd64.zip
asset_path: release.zip
asset_name: wakapi_${{ matrix.alias }}_amd64.zip
asset_content_type: application/gzip