MNT: update GCC versions for ubuntu-latest runner, upgrade build base images #193
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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
go: [1.21.x, 1.22.x, 1.23.x] | |
os: [ubuntu-latest, ubuntu-22.04, macos-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
CGO_ENABLED: 1 | |
steps: | |
- name: Install GCC (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
brew update | |
brew install gcc | |
- name: Install GCC (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt update | |
sudo apt install -y gcc-multilib g++-multilib | |
shell: bash | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Test | |
run: go test -v ./... | |
test-arm64: | |
strategy: | |
matrix: | |
go: [1.21.x, 1.22.x, 1.23.x] | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: 1 | |
GOOS: linux | |
GOARCH: arm64 | |
CC: "/usr/bin/aarch64-linux-gnu-gcc-11" | |
steps: | |
# Patch azure archives for [amd64, i386] use only and add | |
# arm64 ports (derived from ryankurte/action-apt) | |
- name: Update sources for arm64 | |
shell: bash | |
run: | | |
sudo dpkg --add-architecture arm64 | |
sudo echo "Types: deb" > /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "URIs: http://azure.archive.ubuntu.com/ubuntu/" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Suites: noble noble-updates noble-backports noble-security" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Components: main universe restricted multiverse" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Architectures: amd64" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "# Arm64 packages" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Types: deb" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "URIs: http://ports.ubuntu.com/ubuntu-ports/" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Suites: noble noble-updates noble-backports noble-security" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Components: main universe restricted multiverse" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> /etc/apt/sources.list.d/ubuntu.sources | |
sudo echo "Architectures: arm64" >> /etc/apt/sources.list.d/ubuntu.sources | |
- name: Install GCC and SQLite for Arm64 | |
shell: bash | |
run: | | |
sudo apt-get update | |
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \ | |
gcc-14-aarch64-linux-gnu \ | |
libsqlite3-dev:arm64 \ | |
file | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build | |
run: go build -v . | |
shell: bash | |
- name: Verify build | |
run: file mbtileserver | |
shell: bash | |
# NOTE: we can't test an arm64 binary on amd64 host | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install GCC (Ubuntu) | |
run: | | |
sudo apt update | |
sudo apt install -y gcc-multilib g++-multilib | |
shell: bash | |
- name: Install Go | |
if: success() | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.23.x | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Calc coverage | |
run: | | |
go test -v -covermode=count -coverprofile=coverage.out ./... | |
- name: Convert coverage.out to coverage.lcov | |
uses: jandelgado/[email protected] | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: coverage.lcov |