]> source.dussan.org Git - gitea.git/commitdiff
replace `drone exec` to `act_runner exec` in test README.md (#24791)
authora1012112796 <1012112796@qq.com>
Thu, 18 May 2023 19:48:47 +0000 (03:48 +0800)
committerGitHub <noreply@github.com>
Thu, 18 May 2023 19:48:47 +0000 (19:48 +0000)
.github/workflows/pull-db-tests.yml
tests/e2e/README.md
tests/integration/README.md
tests/integration/README_ZH.md

index bef1df15154ec39b7059b596bab850421d57bf13..b3b02f15caf22a91cf2d0e72e610824c68e739fe 100644 (file)
@@ -41,7 +41,7 @@ jobs:
         with:
           go-version: ">=1.20.0"
       - name: Add hosts to /etc/hosts
-        run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts
+        run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
       - run: make deps-backend
       - run: make backend
         env:
@@ -119,7 +119,7 @@ jobs:
         with:
           go-version: ">=1.20.0"
       - name: Add hosts to /etc/hosts
-        run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
+        run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
       - run: make deps-backend
       - run: make backend
         env:
@@ -166,7 +166,7 @@ jobs:
         with:
           go-version: ">=1.20.0"
       - name: Add hosts to /etc/hosts
-        run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
+        run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
       - run: make deps-backend
       - run: make backend
         env:
@@ -195,7 +195,7 @@ jobs:
         with:
           go-version: ">=1.20.0"
       - name: Add hosts to /etc/hosts
-        run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts
+        run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts'
       - run: make deps-backend
       - run: make backend
         env:
@@ -223,7 +223,7 @@ jobs:
         with:
           go-version: ">=1.20.0"
       - name: Add hosts to /etc/hosts
-        run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts
+        run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'
       - run: make deps-backend
       - run: make backend
         env:
index 2d9a0ab8fde3555cc4a7a9e8f0eff6b9abeb9821..bf444ddb800e29e283d28029e5d26bcf1167b2b8 100644 (file)
@@ -22,9 +22,9 @@ npx playwright install-deps
 ```
 
 
-## Run all tests via local drone
+## Run all tests via local act_runner
 ```
-drone exec --local --build-event "pull_request"
+act_runner exec -W ./.github/workflows/pull-e2e-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest
 ```
 
 ## Run sqlite e2e tests
index 636949df38f47a8f0d706e228a424022cce68695..f4e0061314668f93ba24012c3be3a5a3d734ffce 100644 (file)
@@ -15,9 +15,26 @@ Make sure to perform a clean build before running tests:
 make clean build
 ```
 
-## Run all tests via local drone
+## Run tests via local act_runner
+
+### Run all jobs
+
+```
+act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest
 ```
-drone exec --local --build-event "pull_request"
+
+Warning: This file defines many jobs, so it will be resource-intensive and therefor not recommended.
+
+### Run single job
+
+```SHELL
+act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -j <job_name>
+```
+
+You can list all job names via:
+
+```SHELL
+act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -l
 ```
 
 ## Run sqlite integration tests
index 38402324720bbdbc5eaa84ff044483c351a43f73..a924892f815d9196ee22e0b30a1f23a51ce4c3c9 100644 (file)
@@ -12,9 +12,25 @@ make test-sqlite
 make clean build
 ```
 
-## 如何在本地 drone 服务器上运行所有测试
+## 如何在本地 act_runner 上运行测试
+
+### 运行所有任务
+
+```
+act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest
+```
+
+警告:由于在此文件中定义了许多任务,因此此操作将花费太多的CPU和内存来运行。所以不建议这样做。
+
+### 运行单个任务
+
+```SHELL
+act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -j <job_name>
 ```
-drone exec --local --build-event "pull_request"
+
+您可以通过以下方式列出所有任务名称:
+```SHELL
+act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -l
 ```
 
 ## 如何使用 sqlite 数据库进行集成测试