Skip to content

Commit c2078f8

Browse files
authored
Merge pull request #1100 from caic99/develop
CI: add building tests for PR
2 parents 0905df9 + 86a89c9 commit c2078f8

File tree

2 files changed

+55
-7
lines changed

2 files changed

+55
-7
lines changed

.github/workflows/build_test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Build Test
2-
on: push
2+
on:
3+
push:
4+
pull_request:
35

46
jobs:
57
test:
@@ -11,7 +13,7 @@ jobs:
1113
build_args: ""
1214
name: "Build with GNU compilers"
1315
- tag: gnu
14-
build_args: "-DENABLE_LIBXC=1"
16+
build_args: "-DENABLE_LIBXC=1 -DENABLE_DEEPKS=1"
1517
name: "Build with GNU compilers and extra components"
1618
- tag: intel
1719
build_args: ""
@@ -20,7 +22,7 @@ jobs:
2022
build_args: "-DUSE_CUDA=1"
2123
name: "Build with CUDA kit"
2224
name: ${{ matrix.name }}
23-
container: ghcr.io/${{ github.repository_owner }}/abacus-development-kit:${{ matrix.tag }}
25+
container: ghcr.io/deepmodeling/abacus-development-kit:${{ matrix.tag }}
2426
steps:
2527
- name: Checkout
2628
uses: actions/checkout@v3

.github/workflows/performance.yml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,38 @@ on:
44
workflow_dispatch:
55

66
jobs:
7+
start-runner:
8+
name: Start self-hosted EC2 runner
9+
runs-on: ubuntu-latest
10+
outputs:
11+
label: ${{ steps.start-ec2-runner.outputs.label }}
12+
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
13+
steps:
14+
- name: Configure AWS credentials
15+
uses: aws-actions/configure-aws-credentials@v1
16+
with:
17+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
18+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+
aws-region: us-east-2
20+
- name: Start EC2 runner
21+
id: start-ec2-runner
22+
uses: machulav/ec2-github-runner@v2
23+
with:
24+
mode: start
25+
github-token: ${{ secrets.PAT }}
26+
ec2-image-id: ami-04cd9fec4a7a39019
27+
ec2-instance-type: c5.9xlarge
28+
subnet-id: subnet-72d3e53e
29+
security-group-id: sg-06b0c93122c08aeab
30+
731
test:
832
name: Performance test
9-
runs-on: self-hosted
33+
needs: start-runner
34+
runs-on: ${{ needs.start-runner.outputs.label }}
1035
strategy:
1136
matrix:
1237
tag: ["gnu", "intel"]
13-
if: github.repository_owner == 'deepmodeling'
14-
container: ghcr.io/${{ github.repository_owner }}/abacus-development-kit:${{ matrix.tag }}
38+
container: ghcr.io/deepmodeling/abacus-development-kit:${{ matrix.tag }}
1539
timeout-minutes: 2880
1640
steps:
1741
- name: Checkout
@@ -22,7 +46,7 @@ jobs:
2246
- name: Build
2347
run: |
2448
cmake -B build -DENABLE_LIBXC=ON
25-
cmake --build build -j16
49+
cmake --build build -j`nproc`
2650
cmake --install build
2751
- name: Test
2852
run: |
@@ -32,3 +56,25 @@ jobs:
3256
- name: Show Result
3357
run: |
3458
cat examples/performance/sumall.dat
59+
60+
stop-runner:
61+
name: Stop self-hosted EC2 runner
62+
needs:
63+
- start-runner # required to get output from the start-runner job
64+
- test # required to wait when the main job is done
65+
runs-on: ubuntu-latest
66+
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
67+
steps:
68+
- name: Configure AWS credentials
69+
uses: aws-actions/configure-aws-credentials@v1
70+
with:
71+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
72+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73+
aws-region: us-east-2
74+
- name: Stop EC2 runner
75+
uses: machulav/ec2-github-runner@v2
76+
with:
77+
mode: stop
78+
github-token: ${{ secrets.PAT }}
79+
label: ${{ needs.start-runner.outputs.label }}
80+
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

0 commit comments

Comments
 (0)