Files
chromebrew/.github/workflows/Unit-Test.yml

68 lines
3.2 KiB
YAML

---
name: Run Unit Tests on PR
on: workflow_call
jobs:
container_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Dump github context
run: echo "$GITHUB_CONTEXT"
shell: bash
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Get all changed package files
id: changed-ruby-files
uses: tj-actions/changed-files@v44
with:
files: |
packages/*.rb
- name: List all changed package files
uses: tj-actions/changed-files@v44
if: steps.changed-ruby-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-ruby-files.outputs.all_changed_files }}
- name: Unit Tests (x86_64)
run: |
sudo docker run --rm -t satmandu/crewbuild:m90-x86_64 sudo -i -u chronos /bin/bash -c "
echo \"CREW_REPO is ${{ github.event.pull_request.head.repo.clone_url }}\" && \
echo \"CREW_BRANCH is ${{ github.head_ref }}\" && \
CREW_REPO=${{ github.event.pull_request.head.repo.clone_url }} CREW_BRANCH=${{ github.head_ref }} crew update && \
yes | crew upgrade && \
yes | crew install vim && \
yes | crew remove vim && \
ruby ../tests/commands/const.rb && \
ruby ../tests/commands/help.rb && \
ruby ../tests/commands/prop.rb && \
( [[ -v ALL_CHANGED_FILES ]] && [[ -n ALL_CHANGED_FILES ]] && ( for file in ${ALL_CHANGED_FILES}; do
ruby ../tests/prop_test $file && \
ruby ../tests/buildsystem_test $file ; \
done ) || true ) && \
cd ~ && \
git clone --depth=1 --branch=${{ github.head_ref }} ${{ github.event.pull_request.head.repo.clone_url }} build_test && \
cd build_test && \
crew build -f packages/hello_world_chromebrew.rb"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# This is not the best way to do things, a matrix would certainly be better.
- name: Unit Tests (armv7l)
run: |
sudo docker run --platform linux/arm/v7 --rm -t satmandu/crewbuild:m91-armv7l sudo -i -u chronos /bin/bash -c "
echo \"CREW_REPO is ${{ github.event.pull_request.head.repo.clone_url }}\" && \
echo \"CREW_BRANCH is ${{ github.head_ref }}\" && \
CREW_REPO=${{ github.event.pull_request.head.repo.clone_url }} CREW_BRANCH=${{ github.head_ref }} crew update && \
yes | crew upgrade && \
yes | crew install vim && \
yes | crew remove vim && \
ruby ../tests/commands/const.rb && \
ruby ../tests/commands/help.rb && \
ruby ../tests/commands/prop.rb && \
( [[ -v ALL_CHANGED_FILES ]] && [[ -n ALL_CHANGED_FILES ]] && ( for file in ${ALL_CHANGED_FILES}; do
ruby ../tests/prop_test $file && \
ruby ../tests/buildsystem_test $file ; \
done ) || true ) && \
cd ~ && \
git clone --depth=1 --branch=${{ github.head_ref }} ${{ github.event.pull_request.head.repo.clone_url }} build_test && \
cd build_test && \
crew build -f packages/hello_world_chromebrew.rb"