openwrt/.github/workflows/packages.yml
Christian Marangi ebbc806d30
CI: add support for getting ccache cache from S3
Add support for getting ccache cache from S3.
ccache is archieved in a tar and downloaded from S3 Cloud Storage.

For push events, ccache is then uplodaed back to S3 to refresh and have
a ccache cache always fresh.

An additional workflow is added to upload files to an S3 Cloud Storage
from artifacts uplodaed to github. The minio tool is used to upload
files to S3.

If the ccache can't be downloaded from s3, we fallback to github cache
system.

Also limit s3 upload to the openwrt repository since external fork won't
have (obviously) the required secrtes to upload data to the S3 Cloud
Storage.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-05-31 13:22:05 +02:00

81 lines
2.0 KiB
YAML

name: Build all core packages
on:
pull_request:
paths:
- '.github/workflows/build.yml'
- '.github/workflows/packages.yml'
- 'config/**'
- 'include/**'
- 'package/**'
- 'target/linux/generic/**'
- 'toolchain/**'
push:
paths:
- '.github/workflows/build.yml'
- '.github/workflows/packages.yml'
- 'config/**'
- 'include/**'
- 'package/**'
- 'target/linux/generic/**'
- 'toolchain/**'
branches-ignore:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: Build Packages with external toolchain
permissions:
contents: read
packages: read
actions: write
strategy:
fail-fast: False
matrix:
include:
- target: malta
subtarget: be
- target: x86
subtarget: 64
uses: ./.github/workflows/build.yml
with:
container_name: toolchain
target: ${{ matrix.target }}
subtarget: ${{ matrix.subtarget }}
build_kernel: true
build_all_kmods: true
build_all_modules: true
build_full: true
ccache_type: packages
upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }}
upload-ccache-cache-in-s3:
if: github.event_name == 'push' && github.repository_owner == 'openwrt'
name: Upload ccache cache to s3
needs: build
strategy:
fail-fast: False
matrix:
include:
- target: malta
subtarget: be
- target: x86
subtarget: 64
secrets:
s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }}
s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }}
uses: ./.github/workflows/upload-file-s3.yml
with:
endpoint: https://storage.googleapis.com
bucket: openwrt-ci-cache
download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache
filename: ccache-packages-${{ matrix.target }}-${{ matrix.subtarget }}.tar