wings/.github/workflows/push.yaml

76 lines
1.9 KiB
YAML
Raw Normal View History

2022-11-06 20:55:49 +00:00
name: Push
2020-07-04 21:29:03 +00:00
on:
push:
branches:
- develop
2020-07-04 21:29:03 +00:00
pull_request:
branches:
- develop
2022-11-06 20:55:49 +00:00
2020-07-04 21:29:03 +00:00
jobs:
2022-11-06 20:55:49 +00:00
build-and-test:
name: Build and Test
runs-on: ${{ matrix.os }}
2020-10-17 21:13:06 +00:00
strategy:
fail-fast: false
matrix:
2023-07-15 20:40:45 +00:00
os: [ubuntu-22.04]
go: ["1.20.10", "1.21.3"]
2022-11-06 20:55:49 +00:00
goos: [linux]
goarch: [amd64, arm64]
2020-07-04 21:29:03 +00:00
steps:
2022-11-06 20:55:49 +00:00
- name: Setup Go
uses: actions/setup-go@v4
2020-07-04 21:29:03 +00:00
with:
2020-10-17 21:13:06 +00:00
go-version: ${{ matrix.go }}
2022-11-06 20:55:49 +00:00
- name: Code checkout
uses: actions/checkout@v4
2022-11-06 20:55:49 +00:00
- name: go mod download
env:
CGO_ENABLED: 0
2020-12-06 23:12:41 +00:00
run: |
2022-11-06 20:55:49 +00:00
go mod download
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-12-06 23:12:41 +00:00
SRC_PATH: github.com/pterodactyl/wings
2020-10-17 20:52:38 +00:00
run: |
2022-11-06 20:55:49 +00:00
go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o dist/wings ${SRC_PATH}
go build -v -trimpath -ldflags="-X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o dist/wings_debug ${SRC_PATH}
chmod 755 dist/*
- name: go test
2022-11-06 21:39:02 +00:00
if: ${{ matrix.goarch == 'amd64' }}
2022-11-06 20:55:49 +00:00
env:
CGO_ENABLED: 0
run: |
go test $(go list ./...)
- name: go test -race
if: ${{ matrix.goarch == 'amd64' }}
env:
CGO_ENABLED: 1
run: |
go test -race $(go list ./...)
2022-01-30 20:06:56 +00:00
- name: Upload Release Artifact
2023-01-24 19:32:55 +00:00
uses: actions/upload-artifact@v3
if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
2020-10-17 20:52:38 +00:00
with:
2022-01-30 20:06:56 +00:00
name: wings_linux_${{ matrix.goarch }}
2022-11-06 20:55:49 +00:00
path: dist/wings
2022-01-30 20:06:56 +00:00
- name: Upload Debug Artifact
2023-01-24 19:32:55 +00:00
uses: actions/upload-artifact@v3
2022-01-30 20:06:56 +00:00
if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
with:
name: wings_linux_${{ matrix.goarch }}_debug
2022-11-06 20:55:49 +00:00
path: dist/wings_debug