2023-08-15 20:18:48 +08:00
|
|
|
name: Build service and cache
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
build-name:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
build-list:
|
|
|
|
type: string
|
|
|
|
cache-files-list:
|
|
|
|
type: string
|
|
|
|
cache-urls-list:
|
|
|
|
type: string
|
|
|
|
jobs:
|
2023-08-15 21:09:12 +08:00
|
|
|
b:
|
2023-08-15 20:18:48 +08:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
2023-08-15 20:53:29 +08:00
|
|
|
- name: Checkout ${{ github.event.pull_request.base.ref || 'master' }}
|
2023-08-15 20:18:48 +08:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2023-08-15 20:53:29 +08:00
|
|
|
ref: ${{ github.event.pull_request.base.ref || '' }}
|
2023-08-15 20:18:48 +08:00
|
|
|
fetch-depth: 0 # Fetch all history
|
|
|
|
- name: Merge pr-${{ github.event.number }} into ${{ github.event.pull_request.base.ref }}
|
2023-08-15 20:53:29 +08:00
|
|
|
if: github.event_name == 'pull_request'
|
2023-08-15 20:18:48 +08:00
|
|
|
run: |
|
|
|
|
git config user.name "BBB Automated Tests"
|
|
|
|
git config user.email "tests@bigbluebutton.org"
|
|
|
|
git config pull.rebase false
|
|
|
|
git pull origin pull/${{ github.event.number }}/head:${{ github.head_ref }}
|
|
|
|
- name: Set cache-key vars
|
|
|
|
run: |
|
2023-08-15 21:09:41 +08:00
|
|
|
echo "CACHE_KEY_FILES=$(echo '${{ inputs.cache-files-list }} .gitlab-ci.yml' | xargs -n1 git log -1 --format=%h -- | tr '\n' '-' | sed 's/-$//')" >> $GITHUB_ENV
|
2023-08-15 20:18:48 +08:00
|
|
|
echo "CACHE_KEY_URLS=$(echo '${{ inputs.cache-urls-list }}' | xargs -r -n 1 curl -Is | grep -i 'Last-Modified' | md5sum | cut -c1-10)" >> $GITHUB_ENV
|
|
|
|
cat bigbluebutton-config/bigbluebutton-release >> $GITHUB_ENV
|
|
|
|
echo "FORCE_GIT_REV=0" >> $GITHUB_ENV #used by setup.sh
|
|
|
|
echo "FORCE_COMMIT_DATE=0" >> $GITHUB_ENV #used by setup.sh
|
|
|
|
- name: Handle cache
|
|
|
|
if: inputs.cache-files-list != ''
|
|
|
|
id: cache-action
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: artifacts.tar
|
|
|
|
key: ${{ runner.os }}-${{ inputs.build-name }}-${{ env.BIGBLUEBUTTON_RELEASE }}-commits-${{ env.CACHE_KEY_FILES }}-urls-${{ env.CACHE_KEY_URLS }}
|
|
|
|
- if: ${{ steps.cache-action.outputs.cache-hit != 'true' }}
|
|
|
|
name: Generate artifacts
|
|
|
|
run: |
|
|
|
|
./build/get_external_dependencies.sh
|
|
|
|
echo "${{ inputs.build-list || inputs.build-name }}" | xargs -n 1 ./build/setup.sh
|
|
|
|
tar cvf artifacts.tar artifacts/
|
|
|
|
- name: Archive packages
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: artifacts_${{ inputs.build-name }}.tar
|
|
|
|
path: artifacts.tar
|