wings/.github/workflows/build-test.yml

56 lines
1.7 KiB
YAML
Raw Normal View History

2020-11-15 04:42:12 +00:00
name: Run Tests
2020-07-04 21:29:03 +00:00
on:
push:
branches-ignore:
- 'master'
- 'release/**'
2020-07-04 21:29:03 +00:00
pull_request:
jobs:
build:
2020-10-17 21:13:06 +00:00
strategy:
# Default is true, cancels jobs for other platforms in the matrix if one fails
fail-fast: false
matrix:
os: [ ubuntu-20.04 ]
go: [ 1.15.5 ]
2020-10-17 21:13:06 +00:00
goos: [ linux ]
goarch: [ amd64, arm, arm64 ]
runs-on: ${{ matrix.os }}
2020-07-04 21:29:03 +00:00
steps:
- uses: actions/checkout@v2
2020-10-17 21:13:06 +00:00
2020-07-04 21:29:03 +00:00
- uses: actions/setup-go@v2
with:
2020-10-17 21:13:06 +00:00
go-version: ${{ matrix.go }}
2020-07-04 21:29:03 +00:00
- name: Build
2020-10-17 21:13:06 +00:00
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
2020-10-17 20:52:38 +00:00
run: |
2020-10-17 21:13:06 +00:00
go build -v -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go
2020-07-04 21:29:03 +00:00
- name: Test
run: go test ./...
2020-10-17 21:13:06 +00:00
- name: Compress binary and make it executable
2020-07-04 22:10:35 +00:00
if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
2020-10-17 20:52:38 +00:00
run: |
2020-10-17 21:13:06 +00:00
upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }} && chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
2020-07-04 21:29:03 +00:00
- uses: actions/upload-artifact@v2
2020-07-04 22:10:35 +00:00
if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
2020-07-04 21:29:03 +00:00
with:
2020-10-17 21:13:06 +00:00
name: wings_${{ matrix.goos }}_${{ matrix.goarch }}
path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
2020-10-17 20:52:38 +00:00
- uses: actions/upload-artifact@v2
if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
with:
2020-10-17 21:13:06 +00:00
name: wings_${{ matrix.goos }}_${{ matrix.goarch }}
path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }}