diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index d8f959f..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: "Build" - -on: - workflow_call: - inputs: - target: - type: string - required: true - -jobs: - build: - name: Build - runs-on: ${{ inputs.target }} - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - cache: 'pip' - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - components: rustfmt, clippy - - run: pip install build maturin - - run: python3 -m build -n - - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.target }}-dist - path: dist/*.whl - - uses: actions/upload-artifact@v4 - if: ${{ ! startsWith(inputs.target, 'ubuntu') }} - with: - name: ${{ inputs.target }}-dist - path: dist/*.tar.gz diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index e365bf0..6dbb8db 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -1,41 +1,80 @@ -name: "Deploy" +name: Release on: - pull_request: push: branches: - main + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + pull_request: + workflow_dispatch: jobs: - build_linux: - uses: ./.github/workflows/workflow-build-backend.yaml - with: - target: ubuntu-latest - - build_windows: - uses: ./.github/workflows/workflow-build-backend.yaml - with: - target: windows-latest - - build_macos: - uses: ./.github/workflows/workflow-build-backend.yaml - with: - target: macos-latest - - upload: - needs: [build_linux, build_windows, build_macos] - runs-on: ubuntu-latest + release: + name: Release - ${{ matrix.platform.release_for }} + strategy: + matrix: + platform: + # linux + + - release_for: linux-x86_64-gnu + os: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + bin: aqora + name: aqora-linux-x86_64-gnu.tar.gz + + # windows + + - release_for: windows-x86_64-msvc + os: windows-latest + target: x86_64-pc-windows-msvc + bin: aqora.exe + name: aqora-windows-x86_64-msvc.zip + + - release_for: windows-x86_64-gnu + os: windows-latest + target: x86_64-pc-windows-gnu + bin: aqora.exe + name: aqora-windows-x86_64-gnu.zip + + # macos + + - release_for: macos-x86_64 + os: macos-latest + target: x86_64-apple-darwin + bin: aqora + name: aqora-darwin-x86_64.tar.gz + + - release_for: macos-aarch64 + os: macos-latest + target: aarch64-apple-darwin + bin: aqora + name: aqora-darwin-aarch64.tar.gz + + runs-on: ${{ matrix.platform.os }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v5 + - name: Checkout + uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + - name: Build binary + uses: houseabsolute/actions-rust-cross@v0 with: - python-version: '3.10' - cache: 'pip' - - run: pip install twine - - uses: actions/download-artifact@v4 + target: ${{ matrix.platform.target }} + args: "--release" + strip: true + - name: Package as archive + shell: bash + run: | + cd target/${{ matrix.platform.target }}/release + if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then + 7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} + else + tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} + fi + cd - + - name: Publish GitHub release + uses: softprops/action-gh-release@v1 with: - path: dist - merge-multiple: true - - name: Display structure of downloaded files - run: ls -R dist - + draft: true + files: "aqora*" + if: startsWith( github.ref, 'refs/tags/v' ) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8ba1981..7fad2c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,14 +1,17 @@ -name: "Test" +name: Test on: - workflow_call: + pull_request: + push: + branches: + - main jobs: test: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.10' @@ -17,6 +20,7 @@ jobs: profile: minimal toolchain: stable components: rustfmt, clippy + - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all --check - run: cargo clippy -- -D warnings - run: cargo test