added new things #24
This file contains hidden or 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
| # /.github/workflows/python-package.yml | |
| # https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Deploy | |
| on: [push, pull_request] | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| python-version: "3.8" | |
| pyinstaller-version: "6.10" | |
| project-name: python-rl | |
| jobs: | |
| package: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-2019 | |
| platform-name: windows.x64 | |
| - os: macos-10.15 | |
| platform-name: macos.x64 | |
| - os: ubuntu-20.04 | |
| platform-name: linux.x64 | |
| steps: | |
| - name: Checkout code | |
| # fetch-depth=0 and v1 are needed for 'git describe' to work correctly. | |
| uses: actions/checkout@v1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set archive name | |
| run: | | |
| ARCHIVE_NAME=${{ env.project-name }}-`git describe --always`-${{ matrix.platform-name }} | |
| echo "Archive name set to: $ARCHIVE_NAME" | |
| echo "archive-name=$ARCHIVE_NAME" >> $GITHUB_ENV | |
| - name: Set up Python ${{ env.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ env.python-version }} | |
| - name: Install APT dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libsdl2-dev | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install PyInstaller==${{ env.pyinstaller-version }} -r requirements.txt | |
| - name: Run PyInstaller | |
| env: | |
| PYTHONOPTIMIZE: 1 # Enable optimizations as if the -O flag is given. | |
| PYTHONHASHSEED: 42 # Try to ensure deterministic results. | |
| run: | | |
| pyinstaller build.spec | |
| - name: Copy data folder to build folder | |
| run: | | |
| cp -r data dist/PythonRl/data | |
| # This step exists for debugging. Such as checking if data files were included correctly by PyInstaller. | |
| - name: List distribution files | |
| run: | | |
| find dist | |
| # Archive the PyInstaller build using the appropriate tool for the platform. | |
| - name: Tar files | |
| if: runner.os != 'Windows' | |
| run: | | |
| tar --format=ustar -czvf ${{ env.archive-name }}.tar.gz dist/*/ | |
| - name: Archive files | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Compress-Archive dist/*/ ${{ env.archive-name }}.zip | |
| # Upload archives as artifacts, these can be downloaded from the GitHub actions page. | |
| - name: "Upload Artifact" | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: automated-builds | |
| path: ${{ env.archive-name }}.* | |
| retention-days: 7 | |
| if-no-files-found: error | |
| # If a tag is pushed then a new archives are uploaded to GitHub Releases automatically. | |
| - name: Upload release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ${{ env.archive-name }}.* | |
| file_glob: true | |
| tag: ${{ github.ref }} | |
| overwrite: true |