File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (68 lines) | stat: -rw-r--r-- 3,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
summary: Build Go commands across multiple arches

details: |
    This test verifies that the go commands in cmd/ can be built
    for the different supported architectures.

environment:
    X_DEBARCH/armhf: armhf
    X_GOARCH/armhf: arm
    X_GCC/armhf: gcc-arm-linux-gnueabihf
    X_CC/armhf: arm-linux-gnueabihf-gcc

    X_DEBARCH/arm64: arm64
    X_GOARCH/arm64: arm64
    X_GCC/arm64: gcc-aarch64-linux-gnu
    X_CC/arm64: aarch64-linux-gnu-gcc

    X_DEBARCH/s390x: s390x
    X_GOARCH/s390x: s390x
    X_GCC/s390x: gcc-s390x-linux-gnu
    X_CC/s390x: s390x-linux-gnu-gcc

    X_DEBARCH/ppc64el: ppc64el
    X_GOARCH/ppc64el: ppc64le
    X_GCC/ppc64el: gcc-powerpc64le-linux-gnu
    X_CC/ppc64el: powerpc64le-linux-gnu-gcc

prepare: |
    . /etc/os-release
    mkdir -p /tmp/cross-build/src/github.com/snapcore
    cp -ar "$PROJECT_PATH" /tmp/cross-build/src/github.com/snapcore
    chown -R test:12345 /tmp/cross-build

    UBUNTU_ARCHIVE="http://archive.ubuntu.com/ubuntu/"
    if [[ "$SPREAD_BACKEND" =~ google ]]; then
        UBUNTU_ARCHIVE="http://$(cloud-id -l | cut -f2).gce.archive.ubuntu.com/ubuntu/"
    fi

    mv /etc/apt/sources.list /etc/apt/sources.list.orig
    cat > /etc/apt/sources.list <<-EOF
          deb [arch=amd64,i386] $UBUNTU_ARCHIVE $UBUNTU_CODENAME           main universe
          deb [arch=amd64,i386] $UBUNTU_ARCHIVE $UBUNTU_CODENAME-updates   main universe
          deb [arch=amd64,i386] $UBUNTU_ARCHIVE $UBUNTU_CODENAME-backports main universe
          deb [arch=amd64,i386] $UBUNTU_ARCHIVE $UBUNTU_CODENAME-security  main universe

          deb [arch=armhf,arm64,powerpc,ppc64el,s390x] http://ports.ubuntu.com/ $UBUNTU_CODENAME           main universe
          deb [arch=armhf,arm64,powerpc,ppc64el,s390x] http://ports.ubuntu.com/ $UBUNTU_CODENAME-updates   main universe
          deb [arch=armhf,arm64,powerpc,ppc64el,s390x] http://ports.ubuntu.com/ $UBUNTU_CODENAME-backports main universe
          deb [arch=armhf,arm64,powerpc,ppc64el,s390x] http://ports.ubuntu.com/ $UBUNTU_CODENAME-security  main universe
    EOF
    dpkg --add-architecture "$X_DEBARCH"
    apt --quiet -o Dpkg::Progress-Fancy=false update
    apt --yes --quiet -o Dpkg::Progress-Fancy=false install "$X_GCC" libseccomp2:"$X_DEBARCH" libseccomp-dev:"$X_DEBARCH" libblkid-dev:"$X_DEBARCH"

restore: |
    rm -rf /tmp/cross-build
    dpkg -l | awk "/^ii.*$X_DEBARCH/{print \$2}" | xargs apt --yes --quiet -o Dpkg::Progress-Fancy=false autoremove --purge
    dpkg --remove-architecture "$X_DEBARCH"
    mv /etc/apt/sources.list.orig /etc/apt/sources.list
    apt --quiet -o Dpkg::Progress-Fancy=false update

execute: |
    cd /tmp/cross-build/src/github.com/snapcore/snapd
    # grab only packages whose name is 'main'
    #su -c "GOPATH=/tmp/cross-build go mod vendor" test
    for cmd in $( GOPATH=/tmp/cross-build go list -f '{{if eq .Name "main"}}{{.ImportPath}}{{end}}' ./cmd/...); do
      su -c "GOPATH=/tmp/cross-build CGO_ENABLED=1 GOARCH=$X_GOARCH CC=$X_CC go build -mod vendor -v -o /dev/null $cmd" test
    done