1
0
mirror of https://github.com/Jguer/yay synced 2024-07-08 04:16:16 +00:00

ci(builder): update ci builder

This commit is contained in:
jguer 2020-11-17 16:21:44 +01:00
parent 8d9fed2ad0
commit f24e21105e
No known key found for this signature in database
GPG Key ID: 6D6CC9BEA8556B35
4 changed files with 50 additions and 38 deletions

View File

@ -8,30 +8,49 @@ jobs:
build-releases: build-releases:
strategy: strategy:
matrix: matrix:
arch: ["x86_64", "armv7h", "aarch64"] arch:
[
"linux/amd64 x86_64",
"linux/arm/v6 armv6h",
"linux/arm/v7 armv7h",
"linux/arm64 aarch64",
]
name: Build ${{ matrix.arch }} name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Read info - name: Read info
id: tags id: tags
shell: bash shell: bash
run: | run: |
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
- name: Install dependencies arch="${{ matrix.arch }}"
run: sudo apt update -y && sudo apt install -y qemu qemu-user-static echo ::set-output name=PLATFORM::${arch%% *}
- name: Setup qemu-user-static echo ::set-output name=ARCH::${arch##* }
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build ${{ matrix.arch }} release - name: Build ${{ matrix.arch }} release
run: | run: |
mkdir artifacts mkdir artifacts
make docker-release-${{ matrix.arch }} ARCH=${{ matrix.arch }} VERSION=${{ steps.tags.outputs.version }} PREFIX="/usr" docker buildx build --platform ${{ steps.tags.outputs.platform }} \
--build-arg VERSION=${{ steps.tags.outputs.version }} \
--build-arg ARCH=${{ steps.tags.outputs.arch }} \
--build-arg PREFIX="/usr" \
-t yay:${{ steps.tags.outputs.arch }} . --load
make docker-release ARCH=${{ steps.tags.outputs.arch }} VERSION=${{ steps.tags.outputs.version }} PREFIX="/usr"
mv *.tar.gz artifacts mv *.tar.gz artifacts
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: yay_${{ matrix.arch }} name: yay_${{ steps.tags.outputs.arch }}
path: artifacts path: artifacts
create_release: create_release:
name: Create release from this build name: Create release from this build
@ -50,6 +69,9 @@ jobs:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: yay_armv7h name: yay_armv7h
- uses: actions/download-artifact@v2
with:
name: yay_armv6h
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: yay_aarch64 name: yay_aarch64
@ -83,6 +105,16 @@ jobs:
asset_path: ./yay_${{ steps.tags.outputs.version }}_armv7h.tar.gz asset_path: ./yay_${{ steps.tags.outputs.version }}_armv7h.tar.gz
asset_name: yay_${{ steps.tags.outputs.version }}_armv7h.tar.gz asset_name: yay_${{ steps.tags.outputs.version }}_armv7h.tar.gz
asset_content_type: application/tar+gzip asset_content_type: application/tar+gzip
- name: Upload armv6h asset
id: upload-release-asset-armv6h
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./yay_${{ steps.tags.outputs.version }}_armv6h.tar.gz
asset_name: yay_${{ steps.tags.outputs.version }}_armv6h.tar.gz
asset_content_type: application/tar+gzip
- name: Upload aarch64 asset - name: Upload aarch64 asset
id: upload-release-asset-aarch64 id: upload-release-asset-aarch64
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1

View File

@ -1,16 +1,12 @@
ARG BUILD_TAG=devel FROM jguer/yay-builder:latest
FROM samip537/archlinux:${BUILD_TAG}
LABEL maintainer="Jguer,joaogg3 at google mail" LABEL maintainer="Jguer,joaogg3 at google mail"
ARG VERSION
ARG PREFIX
ARG ARCH
WORKDIR /app WORKDIR /app
RUN pacman -Syu --overwrite=* --needed --noconfirm \
go git
COPY go.mod .
COPY go.sum .
RUN go mod download
ENV ARCH=x86_64
COPY . . COPY . .
RUN make release VERSION=${VERSION} PREFIX=${PREFIX} ARCH=${ARCH}

View File

@ -65,24 +65,8 @@ docker-release-all:
make docker-release-x86_64 ARCH=x86_64 make docker-release-x86_64 ARCH=x86_64
make docker-release-aarch64 ARCH=aarch64 make docker-release-aarch64 ARCH=aarch64
.PHONY: docker-release-armv7h docker-release:
docker-release-armv7h: docker create --name yay-$(ARCH) yay:${ARCH}
docker build --build-arg="BUILD_TAG=arm32v7-devel" -t yay-$(ARCH):${VERSION} .
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION} PREFIX=${PREFIX}
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
docker container rm yay-$(ARCH)
.PHONY: docker-release-aarch64
docker-release-aarch64:
docker build --build-arg="BUILD_TAG=arm64v8-devel" -t yay-$(ARCH):${VERSION} .
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION} PREFIX=${PREFIX}
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
docker container rm yay-$(ARCH)
.PHONY: docker-release-x86_64
docker-release-x86_64:
docker build --build-arg="BUILD_TAG=devel" -t yay-$(ARCH):${VERSION} .
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION} PREFIX=${PREFIX}
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE) docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
docker container rm yay-$(ARCH) docker container rm yay-$(ARCH)

View File

@ -4,10 +4,10 @@ LABEL maintainer="Jguer,joaogg3 at google mail"
ENV GO111MODULE=on ENV GO111MODULE=on
WORKDIR /app WORKDIR /app
RUN pacman -Syu --overwrite=* --needed --noconfirm go fakeroot binutils gcc make git &&\ RUN pacman -Syu --overwrite=* --needed --noconfirm go fakeroot binutils gcc make git gettext &&\
rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/* rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/*
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.31.0 RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.32.2
COPY go.mod . COPY go.mod .