Files
chromebrew/.github/workflows/Unit-Test.yml
Satadru Pramanik, DO, MPH, MEng f4cfd30c1f Update meson, rebuild libpsl (#10132)
* meson => 1.5

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild libpsl

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes, use M90 & M91 containwrs for unit tests.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* use our bash in unit tests

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust done logic

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* do not look at ALL_CHANGED_FILES unless it is not empty

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust bash logic

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fix case for non-existent variable check

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* use different bash test

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* change bash logic again

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-07-11 17:08:27 -05:00

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 https://github.com/chromebrew/chromebrew.git build_test && \
cd build_test && \
yes | CREW_CACHE_ENABLED=1 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 https://github.com/chromebrew/chromebrew.git build_test && \
cd build_test && \
yes | CREW_CACHE_ENABLED=1 crew build -f packages/hello_world_chromebrew.rb"