Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(release): Move release to GitHub Actions. #104

Merged
merged 3 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: pixlet

on:
push:
branches:
- main
tags:
- 'v*'

jobs:
build-and-test-release:
name: Build and Test Release Artifacts
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.16.12'

- name: Checkout code
uses: actions/checkout@v2

- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo ./scripts/setup-linux.sh

- name: Install macOS dependencies
if: matrix.os == 'macos-latest'
run: ./scripts/setup-macos.sh

- name: Build
run: make build

- name: Test
run: make test

- name: Build Release Linux
if: matrix.os == 'ubuntu-latest'
run: make release-linux

- name: Build Release macOS
if: matrix.os == 'macos-latest'
run: make release-macos

- name: Upload Release Artifacts
uses: actions/upload-artifact@v2
with:
name: release-artifacts
path: build

create-release:
name: Create Github Release
runs-on: ubuntu-latest
betterengineering marked this conversation as resolved.
Show resolved Hide resolved
environment: release
needs: build-and-test-release
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.16.12'

- name: Fetch Release Artifacts
uses: actions/download-artifact@v2
with:
name: release-artifacts

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: ${{github.ref_name}}
args: release
env:
GITHUB_TOKEN: ${{ secrets.TIDBYT_GITHUB_TOKEN }}
20 changes: 10 additions & 10 deletions .github/workflows/test.yml → .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
on:
push:
branches:
- main
name: pixlet

on:
pull_request:
branches:
- '*'

name: Build & test

jobs:
test:
build-and-test:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
Expand All @@ -28,11 +25,14 @@ jobs:

- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libwebp-dev
run: sudo apt-get install -y libwebp-dev

- name: Install macOS dependencies
if: matrix.os == 'macos-latest'
run: brew install webp

- name: Build & test
run: make build && make test
- name: Build
run: make build

- name: Test
run: make test
7 changes: 2 additions & 5 deletions .goreleaser/fetch-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

set -euo pipefail

mkdir -p artifacts
buildkite-agent artifact download '*' ./artifacts

for dist in "darwin_amd64" "linux_amd64" "darwin_arm64" "linux_arm64"; do
mkdir -p "dist/$dist"
cp "artifacts/$dist" "dist/pixlet_$dist/pixlet"
mkdir -p "dist/pixlet_$dist"
cp "$dist/pixlet" "dist/pixlet_$dist/pixlet"
chmod +x "dist/pixlet_$dist/pixlet"
done
21 changes: 0 additions & 21 deletions scripts/release-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,4 @@ set -e
export RELEASE_ARCHS="linux-x86-64 linux-arm64"
export RELEASE_PLATFORM="linux"

# In order to build release packages on Ubuntu, you'll need the following.
#
# Add arm64 architecture:
# sudo dpkg --add-architecture arm64
#
# Update apt sources in /etc/apt/sources.list to include ubuntu-ports for amr64 support:
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal main restricted
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates main restricted
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal universe
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates universe
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal multiverse
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates multiverse
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-backports main restricted universe multiverse
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-security main restricted
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-security universe
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-security multiverse
#
# Install packages:
# sudo apt update
# sudo apt install -y libwebp-dev libwebp-dev:arm64

source scripts/build-release.sh
35 changes: 35 additions & 0 deletions scripts/setup-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e

dpkg --add-architecture arm64

cat <<EOT > /etc/apt/sources.list
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal-updates universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ focal-security universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ focal-security multiverse

deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-backports main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-security main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-security universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-security multiverse
EOT

apt-get update
apt-get install -y \
libwebp-dev \
libwebp-dev:arm64 \
crossbuild-essential-arm64
7 changes: 7 additions & 0 deletions scripts/setup-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

brew install \
webp \
gnupg