Skip to content

Commit

Permalink
feat(release): Move release to GitHub Actions. (#104)
Browse files Browse the repository at this point in the history
* feat(release): Move release to GitHub Actions.

This commit moves our release process to GitHub actions. The way this
used to work was through our internal build system which makes it really
hard to give any visibility to anyone else. In addition, we were hitting
the limits of our local macOS build system and needed an upgraded agent.

* Split workflows.

This commit splits workflows so that pull requests and main have
differnt workflows.

* Update .github/workflows/main.yml

Co-authored-by: Rohan Singh <rohan@tidbyt.com>

Co-authored-by: Rohan Singh <rohan@tidbyt.com>
  • Loading branch information
betterengineering and rohansingh authored Jan 3, 2022
1 parent 84046d8 commit 48d115c
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 36 deletions.
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
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

0 comments on commit 48d115c

Please sign in to comment.