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

Merge pull request #375 from daief/master

Github Actions add a release for macOS
This commit is contained in:
Ferdinand Mütsch 2022-05-20 09:40:26 +02:00 committed by GitHub
commit 77e6cd9faa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 112 deletions

View File

@ -1,5 +1,4 @@
name: 'Mayhem for API'
name: ci
on:
push:
branches: [ master ]
@ -8,9 +7,33 @@ on:
jobs:
test:
name: 'Unit- & API tests'
runs-on: ubuntu-latest
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: 'Automated pen-tests with Mayhem for API'
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
@ -50,3 +73,28 @@ jobs:
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: mapi.sarif
build:
name: 'Build (Win, Linux, Mac)'
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

@ -8,6 +8,7 @@ on:
jobs:
docker-publish:
name: 'Build and publish Docker image'
runs-on: ubuntu-latest
steps:
- name: Set up QEMU

View File

@ -1,55 +0,0 @@
name: Linux
on:
push:
branches:
pull_request:
release:
types:
- published
jobs:
build-and-release:
name: Linux - Build, Test & Release
runs-on: ubuntu-latest
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
- name: Build
run: GO111MODULE=on go build -v .
- name: Zip executable and sample config
if: github.event_name == 'release'
run: |
cp config.default.yml config.yml
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 }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: release.zip
asset_name: wakapi_linux_amd64.zip
asset_content_type: application/gzip

56
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: Release
on:
release:
types:
- published
jobs:
release:
name: 'Build, package and release to GitHub'
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
include:
- platform: ubuntu-latest
alias: linux
- platform: macos-latest
alias: mac
- platform: windows-latest
alias: win
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 .
- name: Compress working folder on Windows
if: runner.os == 'Windows'
run: |
cp .\config.default.yml .\config.yml
Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath wakapi_${{ matrix.alias }}_amd64.zip
- name: Compress working folder on Unix
if: runner.os != 'Windows'
run: |
cp config.default.yml config.yml
zip -9 wakapi_${{ matrix.alias }}_amd64.zip wakapi config.yml
- name: Upload built executable to Release
uses: softprops/action-gh-release@v1
with:
files: wakapi_${{ matrix.alias }}_amd64.zip

View File

@ -1,51 +0,0 @@
name: Windows
on:
push:
branches:
pull_request:
release:
types:
- published
jobs:
build-and-release:
name: Windows - Build & Release
runs-on: windows-latest
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: Enable Go 1.11 modules
run: cmd /c "set GO111MODULE=on"
- name: Build
run: go build -v .
- name: Compress working folder
if: github.event_name == 'release'
run: |
cp .\config.default.yml .\config.yml
Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath release.zip
- 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 }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: release.zip
asset_name: wakapi_win_amd64.zip
asset_content_type: application/gzip