From ad9e04a304dc0d92b2d4a21701d576ea321fe262 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 13 Sep 2023 10:43:13 +0200 Subject: [PATCH] ci: Merge CD files into a single one --- .github/actions/package-arm/action.yml | 35 -------------------------- .github/actions/package/action.yml | 22 +++++++--------- .github/workflows/release.yml | 16 +++++++++--- 3 files changed, 21 insertions(+), 52 deletions(-) delete mode 100644 .github/actions/package-arm/action.yml diff --git a/.github/actions/package-arm/action.yml b/.github/actions/package-arm/action.yml deleted file mode 100644 index 99ca2a92..00000000 --- a/.github/actions/package-arm/action.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Package Rasberry Pi Release - -inputs: - arch: - required: false - target: - required: true - github_token: - required: true - -runs: - using: composite - steps: - - uses: ./.github/actions/setup-arm - with: - arch: ${{ inputs.arch }} - target: ${{ inputs.target }} - - - name: Build - shell: bash - run: | - cargo build --release --all --target ${{ inputs.target }} --features=raspberry - - - name: Compress - shell: bash - run: | - zip -j cargo-espflash-${{ inputs.target }}.zip target/${{ inputs.target }}/release/cargo-espflash - zip -j espflash-${{ inputs.target }}.zip target/${{ inputs.target }}/release/espflash - - - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ inputs.github_token }} - file: "*.zip" - file_glob: true - tag: ${{ github.ref }} diff --git a/.github/actions/package/action.yml b/.github/actions/package/action.yml index 00bc5f3f..241a8047 100644 --- a/.github/actions/package/action.yml +++ b/.github/actions/package/action.yml @@ -1,32 +1,28 @@ name: Package Release - inputs: - runs_on: + arch: + required: false + github_token: required: true + features: + required: false target: required: true - github_token: + runs_on: required: true runs: using: composite steps: - - uses: dtolnay/rust-toolchain@stable + - uses: ./.github/actions/setup-target with: + arch: ${{ inputs.arch }} target: ${{ inputs.target }} - - uses: Swatinem/rust-cache@v2 - - - name: Install dependencies - if: ${{ inputs.runs_on == 'ubuntu-22.04' }} - shell: bash - run: | - sudo apt-get install musl-tools libudev-dev - - name: Build shell: bash run: | - cargo build --release --all --target ${{ inputs.target }} + cargo build --release --all --target ${{ inputs.target }} ${{ inputs.features }} - name: Compress (Unix) if: ${{ inputs.runs_on != 'windows-2022' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2beb696c..6c257e10 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,21 +15,23 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/package-arm + - uses: ./.github/actions/package with: arch: armhf - target: armv7-unknown-linux-gnueabihf github_token: ${{ secrets.GITHUB_TOKEN }} + features: --features=raspberry + target: armv7-unknown-linux-gnueabihf aarch64-unknown-linux-gnu: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/package-arm + - uses: ./.github/actions/package with: arch: arm64 - target: aarch64-unknown-linux-gnu github_token: ${{ secrets.GITHUB_TOKEN }} + features: --features=raspberry + target: aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu: runs-on: ubuntu-22.04 @@ -37,6 +39,7 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/package with: + arch: x86_64 runs_on: ubuntu-22.04 target: x86_64-unknown-linux-gnu github_token: ${{ secrets.GITHUB_TOKEN }} @@ -47,6 +50,7 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/package with: + arch: x86_64 runs_on: ubuntu-22.04 target: x86_64-unknown-linux-musl github_token: ${{ secrets.GITHUB_TOKEN }} @@ -60,6 +64,8 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/package with: + # This is not true, but simplifies the logic of the action. + arch: x86_64 runs_on: macos-12 target: aarch64-apple-darwin github_token: ${{ secrets.GITHUB_TOKEN }} @@ -70,6 +76,7 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/package with: + arch: x86_64 runs_on: macos-12 target: x86_64-apple-darwin github_token: ${{ secrets.GITHUB_TOKEN }} @@ -83,6 +90,7 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/package with: + arch: x86_64 runs_on: windows-2022 target: x86_64-pc-windows-msvc github_token: ${{ secrets.GITHUB_TOKEN }}