From e3a322651e0b83032c2e19aeb90fee264d026916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZHU=20Yuhao=20=E6=9C=B1=E5=AE=87=E6=B5=A9?= Date: Tue, 4 Mar 2025 11:23:16 +0100 Subject: [PATCH] Add workflows --- .github/workflows/run_tests.yaml | 56 ++++++++++++++++++++++++++++++++ mojoproject.toml | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/run_tests.yaml diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml new file mode 100644 index 00000000..08cbde88 --- /dev/null +++ b/.github/workflows/run_tests.yaml @@ -0,0 +1,56 @@ +name: DeciMojo Unit Tests +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + pull-requests: read + +jobs: + testing-decimojo: + name: with ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-22.04"] + + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + + defaults: + run: + shell: bash + env: + DEBIAN_FRONTEND: noninteractive + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Install magic + run: | + curl -ssL https://magic.modular.com/deb181c4-455c-4abe-a263-afcff49ccf67 | bash + + - name: Add path + run: | + echo "MODULAR_HOME=$HOME/.modular" >> $GITHUB_ENV + echo "$HOME/.modular/bin" >> $GITHUB_PATH + echo "$HOME/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH + + - name: Activate virtualenv + run: | + python3 -m venv $HOME/venv/ + . $HOME/venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV + + - name: Run tests + run: | + magic install + magic run mojo test tests -I . + + - name: Run formating checks + run: | + magic install + magic run mojo format ./ + diff --git a/mojoproject.toml b/mojoproject.toml index 35b7ebf3..b8a40534 100644 --- a/mojoproject.toml +++ b/mojoproject.toml @@ -17,7 +17,7 @@ package = "magic run format && magic run mojo package decimojo && cp decimojo.mo p = "magic run package" # tests -test = "magic run package && magic run mojo tests/*.mojo && magic run mojo test tests" +test = "magic run package && magic run mojo tests/*.mojo && magic run mojo test tests -I ." t = "magic run test" # before commit