diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ed09ef4..7d7d4ea 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -15,19 +15,24 @@ jobs: - uses: actions/setup-go@v2 with: go-version: '1.15.2' - - name: Build - run: GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_linux_amd64 -v wings.go - + run: | + GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_linux_amd64 -v wings.go + GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_linux_arm64 -v wings.go - name: Test run: go test ./... - - name: Compress binary and make it executable if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} - run: upx build/wings_linux_amd64 && chmod +x build/wings_linux_amd64 - + run: | + upx build/wings_linux_amd64 && chmod +x build/wings_linux_amd64 + upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64 - uses: actions/upload-artifact@v2 if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} with: name: wings_linux_amd64 path: build/wings_linux_amd64 + - uses: actions/upload-artifact@v2 + if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} + with: + name: wings_linux_arm64 + path: build/wings_linux_arm64 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9762b4d..72afdea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,31 +13,30 @@ jobs: - uses: actions/setup-go@v2 with: go-version: '1.15.2' - - name: Build env: REF: ${{ github.ref }} - run: 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 - + run: | + 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 + 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 run: go test ./... - - name: Compress binary and make it executable - run: upx --brute build/wings_linux_amd64 && chmod +x build/wings_linux_amd64 - + run: | + upx --brute build/wings_linux_amd64 && chmod +x build/wings_linux_amd64 + upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64 - name: Extract changelog env: REF: ${{ github.ref }} run: | 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` - - name: Create checksum and add to changelog run: | SUM=`cd build && sha256sum wings_linux_amd64` - echo -e "\n#### SHA256 Checksum\n\n\`\`\`\n$SUM\n\`\`\`\n" >> ./RELEASE_CHANGELOG - echo $SUM > checksum.txt - + SUM2=`cd build && sha256sum wings_linux_arm64` + echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n\`\`\`\n" >> ./RELEASE_CHANGELOG + echo -e "$SUM\n$SUM2" > checksums.txt - name: Create release branch env: REF: ${{ github.ref }} @@ -51,7 +50,6 @@ jobs: git add system/const.go git commit -m "bump version for release" git push - - name: Create Release id: create_release uses: actions/create-release@v1 @@ -63,8 +61,7 @@ jobs: body_path: ./RELEASE_CHANGELOG draft: true prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} - - - name: Upload binary + - name: Upload AMD64 Binary id: upload-release-binary uses: actions/upload-release-asset@v1 env: @@ -74,7 +71,16 @@ jobs: asset_path: build/wings_linux_amd64 asset_name: wings_linux_amd64 asset_content_type: application/octet-stream - + - name: Upload ARM64 Binary + id: upload-release-binary + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: build/wings_linux_arm64 + asset_name: wings_linux_arm64 + asset_content_type: application/octet-stream - name: Upload checksum id: upload-release-checksum uses: actions/upload-release-asset@v1 @@ -82,6 +88,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./checksum.txt - asset_name: checksum.txt + asset_path: ./checksums.txt + asset_name: checksums.txt asset_content_type: text/plain diff --git a/Makefile b/Makefile index 8bb1ae9..eb0bfcd 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ build: - GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -gcflags "all=-trimpath=$(PWD)" -o build/wings_linux_amd64 -v wings.go + GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -gcflags "all=-trimpath=$(pwd)" -o build/wings_linux_amd64 -v wings.go + GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -gcflags "all=-trimpath=$(pwd)" -o build/wings_linux_arm64 -v wings.go compress: upx --brute build/wings_* diff --git a/server/filesystem/stat_arm.go b/server/filesystem/stat_arm.go new file mode 100644 index 0000000..2e2918b --- /dev/null +++ b/server/filesystem/stat_arm.go @@ -0,0 +1,13 @@ +package filesystem + +import ( + "syscall" + "time" +) + +// Returns the time that the file/folder was created. +func (s *Stat) CTime() time.Time { + st := s.Info.Sys().(*syscall.Stat_t) + + return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec)) +} \ No newline at end of file