-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest # You can choose a different operating system if needed | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Golang | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.18' # Change this to the version you need | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run build # Adjust the build command based on your project | ||
|
||
- name: Run tests | ||
run: npm test # Adjust the test command based on your project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#Script to build all the solutions for different days | ||
import os, subprocess | ||
|
||
def main(): | ||
#Go two directories up | ||
#Get a list of all directories, sequentially go into them and run go build | ||
current_dir = os.getcwd() | ||
main_dir = os.path.join(current_dir,os.pardir) | ||
os.chdir(main_dir) | ||
directories = [d for d in os.listdir(main_dir) if os.path.isdir(os.path.join(main_dir, d))] | ||
print(directories) | ||
print('*' * 20) | ||
for directory in directories: | ||
current_dir = os.getcwd() | ||
path = os.path.join(main_dir, directory) | ||
all_files = os.listdir(os.getcwd()) | ||
go_files = [f for f in all_files if os.path.isfile(os.path.join(current_dir, f)) and f.endswith(".go")] | ||
#Build these golang files | ||
build_code() | ||
|
||
def build_code(): | ||
#Build all the golang files in current directory | ||
# Run 'go build' command to build Golang code | ||
process = subprocess.Popen(['go', 'build'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | ||
stdout, stderr = process.communicate() | ||
|
||
# Display the output | ||
print("Build Output:") | ||
print(stdout) | ||
|
||
# Display errors, if any | ||
if stderr: | ||
print("Build Errors:") | ||
print(stderr) | ||
|
||
# Check the exit code | ||
if process.returncode == 0: | ||
print("Build succeeded.") | ||
else: | ||
print("Build failed.") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |