From 8df39aac6e94f936e003f608dd96f34edcd952ac Mon Sep 17 00:00:00 2001 From: AlexNg Date: Fri, 15 Mar 2024 10:32:49 +0800 Subject: [PATCH 1/2] feat: Add test suite --- .github/workflows/test-worker.yml | 105 ++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/workflows/test-worker.yml diff --git a/.github/workflows/test-worker.yml b/.github/workflows/test-worker.yml new file mode 100644 index 0000000..02317e7 --- /dev/null +++ b/.github/workflows/test-worker.yml @@ -0,0 +1,105 @@ +name: Run Test Suite + +on: + push: + pull_request: + workflow_dispatch: + +defaults: + run: + shell: bash + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + # This test suite will run for every language version for every OS defined in the matrix + tests-os-matrix: + name: "${{ matrix.language_version }} on ${{ matrix.os }}" + runs-on: "${{ matrix.os }}-latest" + + strategy: + fail-fast: false + matrix: + os: + - ubuntu + - windows + - macos + # Place your language versions you want to test + language_version: ["v1.0.0", "v2.0.0"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Setup your language (This is specific to each language) + # - name: Set up language ${{ matrix.language_version }} + # uses: actions/setup-python@v5 + # with: + # language-version: ${{ matrix.language_version }} + + - name: Install dependencies + run: | + set -xe + echo "Installed dependencies" + # python -m pip install -r requirements.txt (for example) + + - name: Build project + run: | + set -xe + echo "Building" + # Place your code to build your project here + + - name: Testing + run: | + set -xe + echo "Testing project" + # Place your code to test your project here + + # This test will run once + tests: + name: "Testing" + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Setup your language (This is specific to each language) + # - name: Set up language ${{ matrix.language_version }} + # uses: actions/setup-python@v5 + # with: + # language-version: ${{ matrix.language_version }} + + - name: Install dependencies + run: | + set -xe + echo "Installed dependencies" + # python -m pip install -r requirements.txt (for example) + + - name: Build project + run: | + set -xe + echo "Building" + # Place your code to build your project here + + - name: Testing + run: | + set -xe + echo "Testing project" + # Place your code to test your project here + + check: + if: always() + name: Tests Successful + runs-on: ubuntu-latest + needs: [tests-os-matrix, tests] + + steps: + - name: Whether the whole test suite passed + uses: re-actors/alls-green@v1.2.2 + with: + jobs: ${{ toJSON(needs) }} From d8711c019db6c66bf4863ebbb5a26291fab132ab Mon Sep 17 00:00:00 2001 From: AlexNg Date: Fri, 15 Mar 2024 10:37:25 +0800 Subject: [PATCH 2/2] doc: Add recommendation --- .github/workflows/test-worker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-worker.yml b/.github/workflows/test-worker.yml index 02317e7..46f2397 100644 --- a/.github/workflows/test-worker.yml +++ b/.github/workflows/test-worker.yml @@ -92,6 +92,7 @@ jobs: echo "Testing project" # Place your code to test your project here + # It is recommended to require this check to pass before merging a pull request check: if: always() name: Tests Successful