-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (68 loc) · 2.69 KB
/
submit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Run and submit the result
on:
pull_request_target:
types: [labeled]
jobs:
run_and_commit:
name: Run and commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: |
python -m pip install -r requirements_dev.txt
- name: Retrieve user language
id: language
run: |
echo "::set-output name=lang::$(python run.py --language)"
echo "::set-output name=file::$(python run.py --source)"
- uses: actions-rs/toolchain@v1
if: ${{ steps.language.outputs.lang == 'Rust' }}
with:
override: true
toolchain: stable
- uses: pnpm/action-setup@v2.2.2
if: ${{ steps.language.outputs.lang == 'JavaScript' }}
with:
version: latest
- run: |
cd JavaScript && pnpm install
if: ${{ steps.language.outputs.lang == 'JavaScript' }}
- run: |
python -m pip install -r Python/requirements.txt
if: ${{ steps.language.outputs.lang == 'Python' }}
- run: sudo apt update
- run: |
sudo apt install -y cmake gcc-10
if: ${{ steps.language.outputs.lang == 'C_CPP' }}
- run: |
sudo apt install -y openjdk-11-jre maven
if: ${{ steps.language.outputs.lang == 'Java' }}
- uses: FedericoCarboni/setup-ffmpeg@v1
- name: Render the image
run: python ./run.py -y
- uses: actions/upload-artifact@v3
with:
name: ${{ github.event.pull_request.user.login }}-artifact
path: |
${{ github.workspace }}/${{ steps.language.outputs.file }}
${{ github.workspace }}/result.mp4
- name: Upload the result
id: upload
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.UPLOAD_URL }}
method: "POST"
timeout: 20000
contentType: application/x-www-form-urlencoded
data: '{"cipher": "${{ github.event.pull_request.body }}", "github_id": "${{ github.event.pull_request.user.login }}", "language": "${{ steps.language.outputs.lang }}", "auth": "${{ secrets.AUTH_STR }}"}'
files: '{"code": "${{ github.workspace }}/${{ steps.language.outputs.file }}", "video": "${{ github.workspace }}/result.mp4"}'
- name: Validate return code
if: ${{ fromJson(steps.upload.outputs.response).status != 200 }}
run: |
echo "::error::服务器返回错误信息 ${{ fromJson(steps.upload.outputs.response).message }}""