Build packages for Debian Bookworm #416
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
tests: | |
name: Test code | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ 1.18.x, 1.19.x, 1.20.x, 1.21.x, tip ] | |
steps: | |
- name: Set up Go stable | |
if: matrix.go != 'tip' | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Set up Go tip | |
if: matrix.go == 'tip' | |
run: | | |
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz | |
ls -lah gotip.tar.gz | |
mkdir -p ~/sdk/gotip | |
tar -C ~/sdk/gotip -xzf gotip.tar.gz | |
~/sdk/gotip/bin/go version | |
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Checkout to the latest tag | |
run: | | |
# Fetch all tags | |
git fetch --depth=1 --tags | |
# Get the latest tag | |
VERS=$(git tag -l | sort -Vr | head -n1) | |
# Fetch everything to the latest tag | |
git fetch --shallow-since=$(git log $VERS -1 --format=%at) | |
if: ${{ github.event_name == 'push' }} # only when built from master | |
- name: Build project | |
run: make | |
- name: Test | |
run: make test | |
env: | |
CGO_ENABLED: 1 | |
- name: Check Docker images | |
run: | | |
make image | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' # Version range or exact version of a Ruby version to use, using semvers version range syntax. | |
- name: Install packaging dependencies | |
run: | | |
gem install rake fpm:1.10.2 package_cloud | |
go install github.com/mitchellh/gox@latest | |
- name: Check packaging | |
run: | | |
make DEVEL=1 gox-build fpm-deb fpm-rpm | |
make sum-files | |
- name: Upload Artifact | |
if: ${{ matrix.go == 'tip' }} # only upload artifact when built with latest go | |
id: artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-${{ matrix.go }} | |
retention-days: 3 | |
path: | | |
*.deb | |
*.rpm | |
sha256sum | |
md5sum | |
- name: Push packages to the autobuilds repo | |
if: ${{ github.event_name == 'push' && matrix.go == 'tip' }} # only when built from master with latest go | |
run: make DEVEL=1 packagecloud-autobuilds | |
env: | |
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} | |