File tree Expand file tree Collapse file tree 4 files changed +102
-0
lines changed Expand file tree Collapse file tree 4 files changed +102
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build binary 
2+ 
3+ on :
4+   workflow_dispatch :
5+ 
6+ jobs :
7+   deploy :
8+     runs-on : ${{ matrix.os }} 
9+     strategy :
10+       matrix :
11+         os :
12+           - ubuntu-latest 
13+           - windows-latest 
14+           - macos-latest 
15+     steps :
16+     - uses : actions/checkout@v1 
17+     - name : Set up Python 
18+       uses : actions/setup-python@v1 
19+       with :
20+         python-version : ' 3.x' 
21+ 
22+     - name : Install dependencies 
23+       run : | 
24+         python -m pip install --upgrade pip 
25+         pip install -r requirements/requirements.txt 
26+         pip install -r requirements/requirements_dev.txt 
27+         pip install pyinstaller 
28+ 
29+      - name : Build binary 
30+       run : | 
31+         invoke build-binary 
32+ 
33+      - name : Test the binary 
34+       run :
35+         invoke test-binary 
36+ 
37+     - name : Prepare binary for upload 
38+       run :
39+         invoke prepare-binary 
40+ 
Original file line number Diff line number Diff line change 1+ # -*- mode: python -*- 
2+ 
3+ block_cipher  =  None 
4+ 
5+ a  =  Analysis (['bin/aws-gate' ],
6+              pathex = ['.' ],
7+              hiddenimports = [],
8+              hookspath = None ,
9+              runtime_hooks = None ,
10+              cipher = block_cipher )
11+ 
12+ pyz  =  PYZ (a .pure ,
13+           cipher = block_cipher )
14+ 
15+ exe  =  EXE (pyz ,
16+           a .scripts ,
17+           a .binaries ,
18+           a .zipfiles ,
19+           a .datas ,
20+           name = 'aws-gate' ,
21+           debug = False ,
22+           strip = None ,
23+           upx = True ,
24+           console = True )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ flake8==3.8.4
77flake8-bandit==2.1.2
88flake8-bugbear==20.11.1
99hypothesis==6.2.0
10+ invoke==1.5.0
1011placebo==0.9.0
1112pre-commit==2.10.1
1213pylint==2.6.0
Original file line number Diff line number Diff line change 1+ import  hashlib 
2+ import  os 
3+ import  platform 
4+ 
5+ from  invoke  import  task 
6+ 
7+ 
8+ @task  
9+ def  build_binary (ctx ):
10+     ctx .run ("pyinstaller ./aws-gate.spec" )
11+ 
12+ 
13+ @task  
14+ def  test_binary (ctx ):
15+     ctx .run ("./dist/aws-gate --version" )
16+     ctx .run ("./dist/aws-gate --help" )
17+ 
18+ 
19+ @task  
20+ def  prepare_binary (ctx ):  # pylint: disable=unused-argument 
21+     binary_name  =  "aws-gate" 
22+     binary_path  =  f"./dist/{ binary_name }  " 
23+     platform_suffix  =  f"{ platform .system ()}  _{ platform .machine ()}  " 
24+     platform_binary_name  =  f"{ binary_name }  -{ platform_suffix }  " 
25+     platform_binary_path  =  f"{ binary_path }  -{ platform_suffix }  " 
26+ 
27+     os .rename (binary_path , platform_binary_path )
28+ 
29+     with  open (f"{ platform_binary_path }  -sha256sum.txt" , "w" ) as  h :
30+         with  open (f"{ platform_binary_path }  " , "rb" ) as  f :
31+             hash  =  hashlib .sha256 (f .read ()).hexdigest ()
32+             h .write (f"{ hash }    { platform_binary_name } \n " )
33+ 
34+ 
35+ @task  
36+ def  clean_binary (ctx ):
37+     ctx .run ("rm -vrf ./dist" )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments