Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18553 from gustavotrott/tests-ci-build-job-reusable
ci(tests): Make a reusable workflow for the building phase
- Loading branch information
Showing
2 changed files
with
114 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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: | ||
build-and-cache: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout ${{ github.event.pull_request.base.ref }} | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.base.ref }} | ||
fetch-depth: 0 # Fetch all history | ||
- name: Merge pr-${{ github.event.number }} into ${{ github.event.pull_request.base.ref }} | ||
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: | | ||
echo "CACHE_KEY_FILES=$(echo '${{ inputs.cache-files-list }}' | xargs -n1 git log -1 --format=%h -- | tr '\n' '-' | sed 's/-$//')" >> $GITHUB_ENV | ||
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 |
Oops, something went wrong.