起因
- 前段時間,
github
在推薦github actions
,不過一直還在測試中,申請了一下測試資格,下來後,也就簡單測試一下,操作跟普通CI/CD
區別不大,看看文檔就好。過了許久,想着還是可以記錄一下的。 - 本來想接着我之前測試Gitea+DroneCI搭建Unity3d輕量級持續集成平臺,測試一下,利用
github actions
發佈unity3d
的工程的,但是失敗了,主要是unity3d
的docker
鏡像太大,光是配置環境都得花費很長時間,不像本地配置好可以重複使用,反正我是沒有測試成功的。推薦編譯型語言或者其他項目,使用github actions
虛擬主機本身的環境或者輕量級的docker
進行CI/CD
操作。 - 不得不吐槽一下,微軟就是財大氣粗啊,虛擬主機的環境安裝得相當完善,幾乎應有盡有。https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions
Github Actions
- https://github.com/features/actions
- https://help.github.com/en/categories/automating-your-workflow-with-github-actions
- https://help.github.com/en/articles/configuring-a-workflow
示例
其實跟官方示例差不多,簡單加了註釋
name: CI
#觸發事件
on: [push]
jobs:
build:
#運行系統
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
#單個命令
- name: Run a one-line script
run: echo Hello, world!
#多個命令
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
#python 測試
- name: python test
run: |
python3 --version
python test.py
# c++ 測試
- name: cmake test
run: |
mkdir build && cd build
cmake ..
make
./main