Add browser proxy to automatically forward browser connections to local #1130
Workflow file for this run
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
| name: build | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| APP_NAME: dda | |
| PYTHON_VERSION: "3.12" | |
| PYOXIDIZER_VERSION: "0.24.0" | |
| jobs: | |
| python-artifacts: | |
| name: Build wheel and source distribution | |
| runs-on: ubuntu-latest | |
| outputs: | |
| old-version: ${{ steps.version.outputs.old-version }} | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| - name: Install tools | |
| run: uv pip install --system hatch . | |
| - name: Check lock file | |
| run: dda self dep lock --check --verbose | |
| # Windows installers don't accept non-integer versions so we ubiquitously | |
| # perform the following transformation: X.Y.Z.devN -> X.Y.Z.N | |
| - name: Set project version | |
| id: version | |
| run: |- | |
| old_version="$(hatch version)" | |
| version="${old_version/dev/}" | |
| echo "old-version=$old_version" >> $GITHUB_OUTPUT | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| echo "$version" | |
| - name: Build | |
| run: uv build | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: python-artifacts | |
| path: dist/* | |
| if-no-files-found: error | |
| binaries: | |
| name: Binary ${{ matrix.job.target }} (${{ matrix.job.os }}) | |
| needs: | |
| - python-artifacts | |
| runs-on: ${{ matrix.job.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| job: | |
| # Linux | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-22.04 | |
| cross: true | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-22.04 | |
| cross: true | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-22.04 | |
| cross: true | |
| - target: powerpc64le-unknown-linux-gnu | |
| os: ubuntu-22.04 | |
| cross: true | |
| # Windows | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-2022 | |
| - target: i686-pc-windows-msvc | |
| os: windows-2022 | |
| # macOS | |
| - target: aarch64-apple-darwin | |
| os: macos-15 | |
| - target: x86_64-apple-darwin | |
| os: macos-15 | |
| env: | |
| CARGO: cargo | |
| CARGO_BUILD_TARGET: ${{ matrix.job.target }} | |
| PYAPP_REPO: pyapp | |
| PYAPP_VERSION: "0.28.0" | |
| PYAPP_UV_ENABLED: "true" | |
| PYAPP_PASS_LOCATION: "true" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch PyApp | |
| run: >- | |
| mkdir $PYAPP_REPO && curl -L | |
| https://github.com/ofek/pyapp/releases/download/v$PYAPP_VERSION/source.tar.gz | |
| | | |
| tar --strip-components=1 -xzf - -C $PYAPP_REPO | |
| - name: Set up Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| - name: Install Hatch | |
| run: |- | |
| uv pip install --system hatch | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable | |
| with: | |
| targets: ${{ matrix.job.target }} | |
| - name: Set up cross compiling | |
| if: matrix.job.cross | |
| uses: taiki-e/install-action@e0d9d86a6672531fbf9dbf1610fea4b39000a241 # v2.62.27 | |
| with: | |
| tool: cross | |
| - name: Configure cross compiling | |
| if: matrix.job.cross | |
| run: echo "CARGO=cross" >> $GITHUB_ENV | |
| - name: Configure target | |
| run: |- | |
| config_file="$PYAPP_REPO/.cargo/config_${{ matrix.job.target }}.toml" | |
| if [[ -f "$config_file" ]]; then | |
| mv "$config_file" "$PYAPP_REPO/.cargo/config.toml" | |
| fi | |
| - name: Download Python artifacts | |
| if: ${{ !startsWith(github.event.ref, 'refs/tags') }} | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: python-artifacts | |
| path: dist | |
| - name: Configure dev build | |
| if: ${{ !startsWith(github.event.ref, 'refs/tags') }} | |
| run: |- | |
| cd dist | |
| wheel="$(echo *.whl)" | |
| mv "$wheel" "../$PYAPP_REPO" | |
| echo "PYAPP_PROJECT_PATH=$wheel" >> $GITHUB_ENV | |
| - name: Build binary | |
| run: hatch build --target binary | |
| - name: Correct binary version | |
| run: |- | |
| old_version="${{ needs.python-artifacts.outputs.old-version }}" | |
| version="${{ needs.python-artifacts.outputs.version }}" | |
| echo "old_version: $old_version" | |
| echo "version: $version" | |
| if [[ "$version" != "$old_version" ]]; then | |
| cd dist/binary | |
| old_binary="$(ls)" | |
| echo "old_binary: $old_binary" | |
| binary="${old_binary/$old_version/$version}" | |
| echo "binary: $binary" | |
| mv "$old_binary" "$binary" | |
| fi | |
| - name: Archive binary | |
| run: |- | |
| mkdir packaging | |
| cd dist/binary | |
| old_binary="$(ls)" | |
| if [[ "$old_binary" =~ -pc-windows- ]]; then | |
| new_binary="${{ env.APP_NAME }}.exe" | |
| mv "$old_binary" "$new_binary" | |
| 7z a "../../packaging/${{ env.APP_NAME }}-${{ matrix.job.target }}.zip" "$new_binary" | |
| else | |
| new_binary="${{ env.APP_NAME }}" | |
| mv "$old_binary" "$new_binary" | |
| chmod 755 "$new_binary" | |
| tar -czf "../../packaging/${{ env.APP_NAME }}-${{ matrix.job.target }}.tar.gz" "$new_binary" | |
| fi | |
| - name: Upload staged archive | |
| if: runner.os != 'Linux' | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: staged-${{ runner.os }}-${{ matrix.job.target }} | |
| path: packaging/* | |
| if-no-files-found: error | |
| - name: Upload archive | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: standalone-${{ matrix.job.target }} | |
| path: packaging/* | |
| if-no-files-found: error | |
| windows-packaging: | |
| name: Build Windows installers | |
| if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
| needs: | |
| - binaries | |
| - python-artifacts | |
| runs-on: windows-2022 | |
| env: | |
| VERSION: ${{ needs.python-artifacts.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| - name: Install PyOxidizer ${{ env.PYOXIDIZER_VERSION }} | |
| run: uv pip install --system pyoxidizer==${{ env.PYOXIDIZER_VERSION }} | |
| - name: Download staged binaries | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: staged-${{ runner.os }}-* | |
| path: archives | |
| merge-multiple: true | |
| - name: Extract staged binaries | |
| run: |- | |
| mkdir bin | |
| cd archives | |
| for f in *; do | |
| binary_id=${f:0:-4} | |
| 7z e "$f" -o../bin | |
| mv "../bin/${{ env.APP_NAME }}.exe" "../bin/$binary_id.exe" | |
| done | |
| # bin/<APP_NAME>-<TARGET>.exe -> targets/<TARGET>/<APP_NAME>.exe | |
| - name: Prepare binaries | |
| run: |- | |
| mkdir targets | |
| for f in bin/*; do | |
| if [[ "$f" =~ ${{ env.APP_NAME }}-(.+).exe$ ]]; then | |
| target="${BASH_REMATCH[1]}" | |
| mkdir "targets/$target" | |
| mv "$f" "targets/$target/${{ env.APP_NAME }}.exe" | |
| fi | |
| done | |
| - name: Build installers | |
| run: >- | |
| pyoxidizer build windows_installers | |
| --release | |
| --var version ${{ env.VERSION }} | |
| - name: Prepare installers | |
| run: |- | |
| mkdir installers | |
| mv build/*/release/*/*.{exe,msi} installers | |
| cd installers | |
| universal_installer="$(ls *.exe)" | |
| mv "$universal_installer" "${{ env.APP_NAME }}-universal.exe" | |
| - name: Upload binaries | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: standalone-${{ runner.os }} | |
| path: archives/* | |
| if-no-files-found: error | |
| - name: Upload installers | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: installers-${{ runner.os }} | |
| path: installers/* | |
| if-no-files-found: error | |
| macos-packaging-signed: | |
| name: Build macOS installer and sign/notarize artifacts on protected branch/tag | |
| if: github.event_name == 'push' | |
| needs: | |
| - binaries | |
| - python-artifacts | |
| runs-on: macos-15 | |
| environment: | |
| name: protected | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Build and sign macOS package | |
| uses: ./.github/actions/build-macos-package | |
| with: | |
| version: ${{ needs.python-artifacts.outputs.version }} | |
| app-name: ${{ env.APP_NAME }} | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| pyoxidizer-version: ${{ env.PYOXIDIZER_VERSION }} | |
| apple-application-certificate: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTIFICATE }} | |
| apple-application-private-key: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_PRIVATE_KEY }} | |
| apple-installer-certificate: ${{ secrets.APPLE_DEVELOPER_ID_INSTALLER_CERTIFICATE }} | |
| apple-installer-private-key: ${{ secrets.APPLE_DEVELOPER_ID_INSTALLER_PRIVATE_KEY }} | |
| apple-api-key: ${{ secrets.APPLE_APP_STORE_CONNECT_API_DATA }} | |
| macos-packaging-unsigned: | |
| name: Build macOS installer without signing | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| needs: | |
| - binaries | |
| - python-artifacts | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Build macOS package (unsigned) | |
| uses: ./.github/actions/build-macos-package | |
| with: | |
| version: ${{ needs.python-artifacts.outputs.version }} | |
| app-name: ${{ env.APP_NAME }} | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| pyoxidizer-version: ${{ env.PYOXIDIZER_VERSION }} | |
| should-sign: "false" | |
| publish-release: | |
| name: Publish distributions | |
| if: startsWith(github.event.ref, 'refs/tags') | |
| needs: | |
| - binaries | |
| - windows-packaging | |
| - macos-packaging-signed | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Download Python artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: python-artifacts | |
| path: dist | |
| - name: Download binaries | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: standalone-* | |
| path: archives | |
| merge-multiple: true | |
| - name: Download installers | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: installers-* | |
| path: installers | |
| merge-multiple: true | |
| - name: Push Python artifacts to PyPI | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| with: | |
| skip-existing: true | |
| - name: Add assets to current release | |
| uses: softprops/action-gh-release@aec2ec56f94eb8180ceec724245f64ef008b89f5 # v2.4.0 | |
| with: | |
| files: |- | |
| archives/* | |
| installers/* |