Skip to content

Commit

Permalink
chore: Split up ci into ci and cd
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed May 10, 2024
1 parent 069b1b6 commit fd04f32
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 11 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/release_tag.yml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -42,23 +36,49 @@ 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: |
cd target/${{ matrix.job.target }}/release
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:
Expand Down Expand Up @@ -95,7 +115,6 @@ jobs:
crate_publish:
needs: build
if: ${{ success() }} && github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fd04f32

Please sign in to comment.