actions: use 1.15 for release, 1.15 and 1.16 for tests

This commit is contained in:
Matthew Penner 2021-02-20 14:47:42 -07:00
parent 00195b4a5b
commit 7541e769e0
4 changed files with 5 additions and 44 deletions

View File

@ -1,36 +1,28 @@
name: Run Tests name: Run Tests
on: on:
push: push:
branches: branches:
- 'develop' - 'develop'
pull_request: pull_request:
branches: branches:
- 'develop' - 'develop'
jobs: jobs:
build: build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ ubuntu-20.04 ] os: [ ubuntu-20.04 ]
go: [ 1.15.6 ] go: [ '^1.15', '^1.16' ]
goos: [ linux ] goos: [ linux ]
goarch: [ amd64, arm64 ] goarch: [ amd64, arm64 ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Code Checkout - name: Code Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Go v${{ matrix.go }} - name: Setup Go v${{ matrix.go }}
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go }} go-version: ${{ matrix.go }}
- name: Print Environment - name: Print Environment
id: env id: env
run: | run: |
@ -44,7 +36,6 @@ jobs:
echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}" echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}"
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
echo "::set-output name=go_cache::$(go env GOCACHE)" echo "::set-output name=go_cache::$(go env GOCACHE)"
- name: Build Cache - name: Build Cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@ -52,11 +43,9 @@ jobs:
key: ${{ runner.os }}-${{ matrix.go }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-${{ matrix.go }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: | restore-keys: |
${{ runner.os }}-${{ matrix.go }}-go ${{ runner.os }}-${{ matrix.go }}-go
- name: Get Dependencies - name: Get Dependencies
run: | run: |
go get -v -t -d ./... go get -v -t -d ./...
- name: Build - name: Build
env: env:
GOOS: ${{ matrix.goos }} GOOS: ${{ matrix.goos }}
@ -67,13 +56,11 @@ jobs:
go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go
upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }} upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }} chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
- name: Test - name: Test
run: go test ./... run: go test ./...
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} if: ${{ matrix.go == '^1.15' && (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') }}
with: with:
name: wings_${{ matrix.goos }}_${{ matrix.goarch }} name: wings_${{ matrix.goos }}_${{ matrix.goarch }}
path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }} path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }}

View File

@ -1,5 +1,4 @@
name: CodeQL name: CodeQL
on: on:
push: push:
branches: branches:

View File

@ -1,5 +1,4 @@
name: Publish Docker Image name: Publish Docker Image
on: on:
push: push:
branches: branches:
@ -7,46 +6,37 @@ on:
tags: tags:
- 'v*' - 'v*'
jobs: jobs:
push: push:
name: Push name: Push
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
# Always run against a tag, even if the commit into the tag has [docker skip] within the commit message. # Always run against a tag, even if the commit into the tag has [docker skip] within the commit message.
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))" if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
steps: steps:
- name: Code Checkout - name: Code Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Docker Meta - name: Docker Meta
id: docker_meta id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1 uses: crazy-max/ghaction-docker-meta@v1
with: with:
images: ghcr.io/pterodactyl/wings images: ghcr.io/pterodactyl/wings
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
- name: Install buildx - name: Install buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
with: with:
version: v0.5.1 version: v0.5.1
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Get Build Information - name: Get Build Information
id: build_info id: build_info
run: | run: |
echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}" echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}"
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: Release Production Build - name: Release Production Build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
if: "!contains(github.ref, 'develop')" if: "!contains(github.ref, 'develop')"
@ -56,7 +46,6 @@ jobs:
labels: ${{ steps.docker_meta.outputs.labels }} labels: ${{ steps.docker_meta.outputs.labels }}
push: true push: true
tags: ${{ steps.docker_meta.outputs.tags }} tags: ${{ steps.docker_meta.outputs.tags }}
- name: Release Development Build - name: Release Development Build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
if: "contains(github.ref, 'develop')" if: "contains(github.ref, 'develop')"

View File

@ -1,51 +1,41 @@
name: Create Release name: Create Release
on: on:
push: push:
tags: tags:
- 'v*' - 'v*'
jobs: jobs:
release: release:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Code Checkout - name: Code Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: actions/setup-go@v2 - uses: actions/setup-go@v2
with: with:
go-version: '1.15.6' go-version: '^1.15'
- name: Build - name: Build
env: env:
REF: ${{ github.ref }} REF: ${{ github.ref }}
run: | run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_amd64 -v wings.go CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_amd64 -v wings.go
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_arm64 -v wings.go CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_arm64 -v wings.go
- name: Test - name: Test
run: go test ./... run: go test ./...
- name: Compress binary and make it executable - name: Compress binary and make it executable
run: | run: |
upx build/wings_linux_amd64 && chmod +x build/wings_linux_amd64 upx build/wings_linux_amd64 && chmod +x build/wings_linux_amd64
upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64 upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64
- name: Extract changelog - name: Extract changelog
env: env:
REF: ${{ github.ref }} REF: ${{ github.ref }}
run: | run: |
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md` echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md`
- name: Create checksum and add to changelog - name: Create checksum and add to changelog
run: | run: |
SUM=`cd build && sha256sum wings_linux_amd64` SUM=`cd build && sha256sum wings_linux_amd64`
SUM2=`cd build && sha256sum wings_linux_arm64` SUM2=`cd build && sha256sum wings_linux_arm64`
echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n\`\`\`\n" >> ./RELEASE_CHANGELOG echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n\`\`\`\n" >> ./RELEASE_CHANGELOG
echo -e "$SUM\n$SUM2" > checksums.txt echo -e "$SUM\n$SUM2" > checksums.txt
- name: Create release branch - name: Create release branch
env: env:
REF: ${{ github.ref }} REF: ${{ github.ref }}
@ -59,7 +49,6 @@ jobs:
git add system/const.go git add system/const.go
git commit -m "bump version for release" git commit -m "bump version for release"
git push git push
- name: Create Release - name: Create Release
id: create_release id: create_release
uses: actions/create-release@v1 uses: actions/create-release@v1
@ -71,7 +60,6 @@ jobs:
body_path: ./RELEASE_CHANGELOG body_path: ./RELEASE_CHANGELOG
draft: true draft: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
- name: Upload amd64 Binary - name: Upload amd64 Binary
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
@ -81,7 +69,6 @@ jobs:
asset_path: build/wings_linux_amd64 asset_path: build/wings_linux_amd64
asset_name: wings_linux_amd64 asset_name: wings_linux_amd64
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- name: Upload arm64 Binary - name: Upload arm64 Binary
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
@ -91,7 +78,6 @@ jobs:
asset_path: build/wings_linux_arm64 asset_path: build/wings_linux_arm64
asset_name: wings_linux_arm64 asset_name: wings_linux_arm64
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- name: Upload checksum - name: Upload checksum
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env: