diff --git a/.github/workflows/release_tag.yml b/.github/workflows/cd.yml similarity index 84% rename from .github/workflows/release_tag.yml rename to .github/workflows/cd.yml index 9690b9d..ebb4eb4 100644 --- a/.github/workflows/release_tag.yml +++ b/.github/workflows/cd.yml @@ -1,14 +1,13 @@ -name: Build and release on tag creation +name: CD on: - pull_request: push: tags: - 'v*.*.*' jobs: build: - name: Build and release for ${{ matrix.job.os }} + name: Build strategy: matrix: job: @@ -24,11 +23,6 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - - name: Install rust toolchain uses: actions-rs/toolchain@v1 with: @@ -42,6 +36,27 @@ jobs: command: build args: --release --bin c2g --target ${{ matrix.job.target }} + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + + - name: Upload target + uses: actions/upload-artifact@v3 + with: + name: target + path: "target/${{ matrix.job.target }}/release/c2g" + if-no-files-found: ignore + + + github_release: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Package shell: bash run: | @@ -49,16 +64,21 @@ jobs: tar czvf ../../../c2g-${{ matrix.job.target }}.tar.gz c2g cd - + - name: Download targets + uses: actions/download-artifact@v3 + with: + name: target + - name: Release uses: softprops/action-gh-release@v1 with: - files: 'c2g*' + files: 'target/*/release/c2g*' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + image_release: needs: build - if: ${{ success() }} && github.event_name != 'pull_request' runs-on: ubuntu-latest steps: @@ -95,7 +115,6 @@ jobs: crate_publish: needs: build - if: ${{ success() }} && github.event_name != 'pull_request' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c136be6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + name: Build + strategy: + matrix: + job: + - { os: macos-latest, target: x86_64-apple-darwin, use-cross: false } + - { os: windows-latest, target: x86_64-pc-windows-msvc, use-cross: false } + - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu, use-cross: false } + - { os: ubuntu-latest, target: x86_64-unknown-linux-musl, use-cross: true } + - { os: ubuntu-latest, target: arm-unknown-linux-gnueabihf, use-cross: true } + - { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, use-cross: true } + runs-on: ${{ matrix.job.os }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Build target + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.job.use-cross }} + command: build + args: --release --bin c2g --target ${{ matrix.job.target }} + + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test