CI: more checks in build and rework compression (#3336)
* CI: build: fail fast if setup.py fails on windows * CI: build: fail for missing uploads, rework compression Upload-artifact allows setting compression level now. The change speeds up both upload and extraction. * CI: match build gz in release * CI: build: verify worlds all load * CI: build: generate a game * Generate: move worlds loaded exception to allow settings to init from worlds * CI: build: build setup before running tests
This commit is contained in:
		
							parent
							
								
									acf85eb9ab
								
							
						
					
					
						commit
						c108845d1f
					
				| 
						 | 
					@ -40,6 +40,10 @@ jobs:
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          python -m pip install --upgrade pip
 | 
					          python -m pip install --upgrade pip
 | 
				
			||||||
          python setup.py build_exe --yes
 | 
					          python setup.py build_exe --yes
 | 
				
			||||||
 | 
					          if ( $? -eq $false ) {
 | 
				
			||||||
 | 
					            Write-Error "setup.py failed!"
 | 
				
			||||||
 | 
					            exit 1
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          $NAME="$(ls build | Select-String -Pattern 'exe')".Split('.',2)[1]
 | 
					          $NAME="$(ls build | Select-String -Pattern 'exe')".Split('.',2)[1]
 | 
				
			||||||
          $ZIP_NAME="Archipelago_$NAME.7z"
 | 
					          $ZIP_NAME="Archipelago_$NAME.7z"
 | 
				
			||||||
          echo "$NAME -> $ZIP_NAME"
 | 
					          echo "$NAME -> $ZIP_NAME"
 | 
				
			||||||
| 
						 | 
					@ -49,12 +53,6 @@ jobs:
 | 
				
			||||||
          Rename-Item "exe.$NAME" Archipelago
 | 
					          Rename-Item "exe.$NAME" Archipelago
 | 
				
			||||||
          7z a -mx=9 -mhe=on -ms "../dist/$ZIP_NAME" Archipelago
 | 
					          7z a -mx=9 -mhe=on -ms "../dist/$ZIP_NAME" Archipelago
 | 
				
			||||||
          Rename-Item Archipelago "exe.$NAME"  # inno_setup.iss expects the original name
 | 
					          Rename-Item Archipelago "exe.$NAME"  # inno_setup.iss expects the original name
 | 
				
			||||||
      - name: Store 7z
 | 
					 | 
				
			||||||
        uses: actions/upload-artifact@v4
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          name: ${{ env.ZIP_NAME }}
 | 
					 | 
				
			||||||
          path: dist/${{ env.ZIP_NAME }}
 | 
					 | 
				
			||||||
          retention-days: 7  # keep for 7 days, should be enough
 | 
					 | 
				
			||||||
      - name: Build Setup
 | 
					      - name: Build Setup
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          & "${env:ProgramFiles(x86)}\Inno Setup 6\iscc.exe" inno_setup.iss /DNO_SIGNTOOL
 | 
					          & "${env:ProgramFiles(x86)}\Inno Setup 6\iscc.exe" inno_setup.iss /DNO_SIGNTOOL
 | 
				
			||||||
| 
						 | 
					@ -65,11 +63,38 @@ jobs:
 | 
				
			||||||
          $contents = Get-ChildItem -Path setups/*.exe -Force -Recurse
 | 
					          $contents = Get-ChildItem -Path setups/*.exe -Force -Recurse
 | 
				
			||||||
          $SETUP_NAME=$contents[0].Name
 | 
					          $SETUP_NAME=$contents[0].Name
 | 
				
			||||||
          echo "SETUP_NAME=$SETUP_NAME" >> $Env:GITHUB_ENV
 | 
					          echo "SETUP_NAME=$SETUP_NAME" >> $Env:GITHUB_ENV
 | 
				
			||||||
 | 
					      - name: Check build loads expected worlds
 | 
				
			||||||
 | 
					        shell: bash
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          cd build/exe*
 | 
				
			||||||
 | 
					          mv Players/Templates/meta.yaml .
 | 
				
			||||||
 | 
					          ls -1 Players/Templates | sort > setup-player-templates.txt
 | 
				
			||||||
 | 
					          rm -R Players/Templates
 | 
				
			||||||
 | 
					          timeout 30 ./ArchipelagoLauncher "Generate Template Options" || true
 | 
				
			||||||
 | 
					          ls -1 Players/Templates | sort > generated-player-templates.txt
 | 
				
			||||||
 | 
					          cmp setup-player-templates.txt generated-player-templates.txt \
 | 
				
			||||||
 | 
					            || diff setup-player-templates.txt generated-player-templates.txt
 | 
				
			||||||
 | 
					          mv meta.yaml Players/Templates/
 | 
				
			||||||
 | 
					      - name: Test Generate
 | 
				
			||||||
 | 
					        shell: bash
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          cd build/exe*
 | 
				
			||||||
 | 
					          cp Players/Templates/Clique.yaml Players/
 | 
				
			||||||
 | 
					          timeout 30 ./ArchipelagoGenerate
 | 
				
			||||||
 | 
					      - name: Store 7z
 | 
				
			||||||
 | 
					        uses: actions/upload-artifact@v4
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          name: ${{ env.ZIP_NAME }}
 | 
				
			||||||
 | 
					          path: dist/${{ env.ZIP_NAME }}
 | 
				
			||||||
 | 
					          compression-level: 0  # .7z is incompressible by zip
 | 
				
			||||||
 | 
					          if-no-files-found: error
 | 
				
			||||||
 | 
					          retention-days: 7  # keep for 7 days, should be enough
 | 
				
			||||||
      - name: Store Setup
 | 
					      - name: Store Setup
 | 
				
			||||||
        uses: actions/upload-artifact@v4
 | 
					        uses: actions/upload-artifact@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          name: ${{ env.SETUP_NAME }}
 | 
					          name: ${{ env.SETUP_NAME }}
 | 
				
			||||||
          path: setups/${{ env.SETUP_NAME }}
 | 
					          path: setups/${{ env.SETUP_NAME }}
 | 
				
			||||||
 | 
					          if-no-files-found: error
 | 
				
			||||||
          retention-days: 7  # keep for 7 days, should be enough
 | 
					          retention-days: 7  # keep for 7 days, should be enough
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  build-ubuntu2004:
 | 
					  build-ubuntu2004:
 | 
				
			||||||
| 
						 | 
					@ -110,7 +135,7 @@ jobs:
 | 
				
			||||||
          echo -e "setup.py dist output:\n `ls dist`"
 | 
					          echo -e "setup.py dist output:\n `ls dist`"
 | 
				
			||||||
          cd dist && export APPIMAGE_NAME="`ls *.AppImage`" && cd ..
 | 
					          cd dist && export APPIMAGE_NAME="`ls *.AppImage`" && cd ..
 | 
				
			||||||
          export TAR_NAME="${APPIMAGE_NAME%.AppImage}.tar.gz"
 | 
					          export TAR_NAME="${APPIMAGE_NAME%.AppImage}.tar.gz"
 | 
				
			||||||
          (cd build && DIR_NAME="`ls | grep exe`" && mv "$DIR_NAME" Archipelago && tar -czvf ../dist/$TAR_NAME Archipelago && mv Archipelago "$DIR_NAME")
 | 
					          (cd build && DIR_NAME="`ls | grep exe`" && mv "$DIR_NAME" Archipelago && tar -cv Archipelago | gzip -8 > ../dist/$TAR_NAME && mv Archipelago "$DIR_NAME")
 | 
				
			||||||
          echo "APPIMAGE_NAME=$APPIMAGE_NAME" >> $GITHUB_ENV
 | 
					          echo "APPIMAGE_NAME=$APPIMAGE_NAME" >> $GITHUB_ENV
 | 
				
			||||||
          echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
 | 
					          echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
 | 
				
			||||||
      # - copy code above to release.yml -
 | 
					      # - copy code above to release.yml -
 | 
				
			||||||
| 
						 | 
					@ -118,15 +143,36 @@ jobs:
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          source venv/bin/activate
 | 
					          source venv/bin/activate
 | 
				
			||||||
          python setup.py build_exe --yes
 | 
					          python setup.py build_exe --yes
 | 
				
			||||||
 | 
					      - name: Check build loads expected worlds
 | 
				
			||||||
 | 
					        shell: bash
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          cd build/exe*
 | 
				
			||||||
 | 
					          mv Players/Templates/meta.yaml .
 | 
				
			||||||
 | 
					          ls -1 Players/Templates | sort > setup-player-templates.txt
 | 
				
			||||||
 | 
					          rm -R Players/Templates
 | 
				
			||||||
 | 
					          timeout 30 ./ArchipelagoLauncher "Generate Template Options" || true
 | 
				
			||||||
 | 
					          ls -1 Players/Templates | sort > generated-player-templates.txt
 | 
				
			||||||
 | 
					          cmp setup-player-templates.txt generated-player-templates.txt \
 | 
				
			||||||
 | 
					            || diff setup-player-templates.txt generated-player-templates.txt
 | 
				
			||||||
 | 
					          mv meta.yaml Players/Templates/
 | 
				
			||||||
 | 
					      - name: Test Generate
 | 
				
			||||||
 | 
					        shell: bash
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          cd build/exe*
 | 
				
			||||||
 | 
					          cp Players/Templates/Clique.yaml Players/
 | 
				
			||||||
 | 
					          timeout 30 ./ArchipelagoGenerate
 | 
				
			||||||
      - name: Store AppImage
 | 
					      - name: Store AppImage
 | 
				
			||||||
        uses: actions/upload-artifact@v4
 | 
					        uses: actions/upload-artifact@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          name: ${{ env.APPIMAGE_NAME }}
 | 
					          name: ${{ env.APPIMAGE_NAME }}
 | 
				
			||||||
          path: dist/${{ env.APPIMAGE_NAME }}
 | 
					          path: dist/${{ env.APPIMAGE_NAME }}
 | 
				
			||||||
 | 
					          if-no-files-found: error
 | 
				
			||||||
          retention-days: 7
 | 
					          retention-days: 7
 | 
				
			||||||
      - name: Store .tar.gz
 | 
					      - name: Store .tar.gz
 | 
				
			||||||
        uses: actions/upload-artifact@v4
 | 
					        uses: actions/upload-artifact@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          name: ${{ env.TAR_NAME }}
 | 
					          name: ${{ env.TAR_NAME }}
 | 
				
			||||||
          path: dist/${{ env.TAR_NAME }}
 | 
					          path: dist/${{ env.TAR_NAME }}
 | 
				
			||||||
 | 
					          compression-level: 0  # .gz is incompressible by zip
 | 
				
			||||||
 | 
					          if-no-files-found: error
 | 
				
			||||||
          retention-days: 7
 | 
					          retention-days: 7
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,7 +69,7 @@ jobs:
 | 
				
			||||||
          echo -e "setup.py dist output:\n `ls dist`"
 | 
					          echo -e "setup.py dist output:\n `ls dist`"
 | 
				
			||||||
          cd dist && export APPIMAGE_NAME="`ls *.AppImage`" && cd ..
 | 
					          cd dist && export APPIMAGE_NAME="`ls *.AppImage`" && cd ..
 | 
				
			||||||
          export TAR_NAME="${APPIMAGE_NAME%.AppImage}.tar.gz"
 | 
					          export TAR_NAME="${APPIMAGE_NAME%.AppImage}.tar.gz"
 | 
				
			||||||
          (cd build && DIR_NAME="`ls | grep exe`" && mv "$DIR_NAME" Archipelago && tar -czvf ../dist/$TAR_NAME Archipelago && mv Archipelago "$DIR_NAME")
 | 
					          (cd build && DIR_NAME="`ls | grep exe`" && mv "$DIR_NAME" Archipelago && tar -cv Archipelago | gzip -8 > ../dist/$TAR_NAME && mv Archipelago "$DIR_NAME")
 | 
				
			||||||
          echo "APPIMAGE_NAME=$APPIMAGE_NAME" >> $GITHUB_ENV
 | 
					          echo "APPIMAGE_NAME=$APPIMAGE_NAME" >> $GITHUB_ENV
 | 
				
			||||||
          echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
 | 
					          echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
 | 
				
			||||||
      # - code above copied from build.yml -
 | 
					      # - code above copied from build.yml -
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,13 +66,15 @@ def get_seed_name(random_source) -> str:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main(args=None):
 | 
					def main(args=None):
 | 
				
			||||||
 | 
					    # __name__ == "__main__" check so unittests that already imported worlds don't trip this.
 | 
				
			||||||
 | 
					    if __name__ == "__main__" and "worlds" in sys.modules:
 | 
				
			||||||
 | 
					        raise Exception("Worlds system should not be loaded before logging init.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not args:
 | 
					    if not args:
 | 
				
			||||||
        args = mystery_argparse()
 | 
					        args = mystery_argparse()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    seed = get_seed(args.seed)
 | 
					    seed = get_seed(args.seed)
 | 
				
			||||||
    # __name__ == "__main__" check so unittests that already imported worlds don't trip this.
 | 
					
 | 
				
			||||||
    if __name__ == "__main__" and "worlds" in sys.modules:
 | 
					 | 
				
			||||||
        raise Exception("Worlds system should not be loaded before logging init.")
 | 
					 | 
				
			||||||
    Utils.init_logging(f"Generate_{seed}", loglevel=args.log_level)
 | 
					    Utils.init_logging(f"Generate_{seed}", loglevel=args.log_level)
 | 
				
			||||||
    random.seed(seed)
 | 
					    random.seed(seed)
 | 
				
			||||||
    seed_name = get_seed_name(random)
 | 
					    seed_name = get_seed_name(random)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue