The invention discloses a computer program compiling method and apparatus. The computer program compiling method comprises: S1, pre-configuring a compiling environment; S2, configuring a compiling script; S3, setting a computer task for starting the compiling script; S4, starting the computer task, and entering a compiling process, wherein the compiling process comprises: T1, detecting whether a server code is updated, executing T2 if yes, and if no, executing T3; T2, updating a local code, and then executing T4; T3, stopping compiling; T4, starting the compiling script, starting to compile and recording compile output information. According to the invention, the defect of time and labor waste caused by manual code update and manual computer program compiling in the prior art is overcome, time required for program compiling can be greatly shortened, and the computer program compiling method and apparatus have the advantages of reducing workload of a programmer, saving labor and improving working efficiency.