Skip to content

Commit

Permalink
Merge pull request #18553 from gustavotrott/tests-ci-build-job-reusable
Browse files Browse the repository at this point in the history
ci(tests): Make a reusable workflow for the building phase
  • Loading branch information
gustavotrott committed Aug 15, 2023
2 parents 01e3367 + 8adec98 commit 933b821
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 399 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/automated-tests-build-package-job.yml
@@ -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

0 comments on commit 933b821

Please sign in to comment.