2022-11-06 20:55:49 +00:00
|
|
|
name: Push
|
|
|
|
|
2020-07-04 21:29:03 +00:00
|
|
|
on:
|
|
|
|
push:
|
2020-12-08 16:11:15 +00:00
|
|
|
branches:
|
2021-07-12 17:06:22 +00:00
|
|
|
- develop
|
2020-07-04 21:29:03 +00:00
|
|
|
pull_request:
|
2020-12-08 16:11:15 +00:00
|
|
|
branches:
|
2021-07-12 17:06:22 +00:00
|
|
|
- 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]
|
2024-03-13 03:43:50 +00:00
|
|
|
go: ["1.21.8", "1.22.1"]
|
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
|
2023-12-19 21:38:48 +00:00
|
|
|
uses: actions/setup-go@v5
|
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
|
|
|
|
2023-05-10 18:37:35 +00:00
|
|
|
- name: Code checkout
|
2023-10-10 18:43:02 +00:00
|
|
|
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 }}
|
2020-11-08 06:42:55 +00:00
|
|
|
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-12-19 21:42:11 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2024-03-13 03:43:50 +00:00
|
|
|
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.21.8' }}
|
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-12-19 21:42:11 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2024-03-13 03:43:50 +00:00
|
|
|
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.21.8' }}
|
2022-01-30 20:06:56 +00:00
|
|
|
with:
|
|
|
|
name: wings_linux_${{ matrix.goarch }}_debug
|
2022-11-06 20:55:49 +00:00
|
|
|
path: dist/wings_debug
|