Skip to content

Fix UC image size #2002

Fix UC image size

Fix UC image size #2002

name: Build and Tests
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
test-scenario: [short, long]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: build go binary
run: go build ./...
- name: apt-update
run: sudo apt update
- name: install-test-dependencies
run: sudo apt install -y snapd germinate e2fsprogs mtools debootstrap eatmydata fdisk gdisk qemu-system-aarch64 qemu-user-static ubuntu-dev-tools
- name: short tests
if: ${{ matrix.test-scenario == 'short' }}
run: sudo go test -timeout 0 -v -test.short -coverprofile=.coverage/coverage-short.out -coverpkg $(go list ./... 2> /dev/null | tr '\n' ",") -covermode=atomic ./...
- name: long tests
if: ${{ matrix.test-scenario == 'long' }}
run: sudo go test -timeout 0 -v -coverprofile=.coverage/coverage-long.out -coverpkg $(go list ./... 2> /dev/null | tr '\n' ",") -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
flags: unittests
files: .coverage/coverage-*.out
verbose: true
- name: Upload coverage report to artifacts
uses: actions/upload-artifact@v4
with:
name: ubuntu-image-coverage-${{ matrix.test-scenario }}
path: .coverage/coverage-*.out
retention-days: 1
mkfs-conf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: apt-update
run: sudo apt update
- name: install-test-dependencies
run: sudo apt install -y devscripts
- name: check mkfs conf updates
id: check-mkfs
shell: bash
run: ./tools/check-mkfs-confs.sh
tics-report:
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'push' || github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Download coverage report artifact
uses: actions/download-artifact@v4
with:
name: ubuntu-image-coverage-long
path: .coverage
- name: Install tools
run: |
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Convert report to xml
run: |
cd .coverage && \
gocov convert coverage-long.out > coverage.json && \
gocov-xml < coverage.json > coverage-go.xml
- name: TICS analysis and report
run: |
export TICSAUTHTOKEN=${{ secrets.TICSAUTHTOKEN }}
set -x
# Install the TICS and staticcheck
curl --silent --show-error "https://canonical.tiobe.com/tiobeweb/TICS/api/public/v1/fapi/installtics/Script?cfg=default&platform=linux&url=https://canonical.tiobe.com/tiobeweb/TICS/" > install_tics.sh
. ./install_tics.sh
TICSQServer -project ubuntu-image -tmpdir /tmp/tics -branchdir .