diff --git a/.github/actions/show-env/action.yml b/.github/actions/show-env/action.yml index 29869ed..7ccc124 100644 --- a/.github/actions/show-env/action.yml +++ b/.github/actions/show-env/action.yml @@ -8,6 +8,5 @@ runs: shell: bash run: | cargo -V - cargo fmt -- -V rustc -V uname -a diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 2976a1b..b554ffe 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,18 +1,26 @@ name: Audit on: - push: pull_request: + types: + - opened + - reopened + - synchronize + paths: + - 'Cargo.lock' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: audit: - name: ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-22.04] steps: - name: Checkout @@ -21,12 +29,12 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Setup Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@master with: - toolchain: stable + toolchain: 1.81.0 - - name: Show environment information + - name: Show env uses: ./.github/actions/show-env - - name: Run cargo-audit + - name: Audit uses: ./.github/actions/audit diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml deleted file mode 100644 index e34053f..0000000 --- a/.github/workflows/build-dev.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Build / Development - -on: - pull_request: - branches: - - main - -jobs: - build-dev: - name: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.toolchain }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - # we only need to support linux - os: [ubuntu-20.04, ubuntu-latest] - # TODO: do we want to support musl? - target: [x86_64-unknown-linux-gnu] - # make sure it runs on latest stable - toolchain: [stable] - - env: - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: "sccache" - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - submodules: true - - - name: Install Toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.toolchain }} - - - name: Install Protoc - uses: arduino/setup-protoc@v3 - - - name: Show Rust toolchain version - shell: bash - run: | - cargo -V - cargo clippy -V - cargo fmt -- -V - rustc -V - - # - name: Setup musl-tools - # if: matrix.target == 'x86_64-unknown-linux-musl' - # shell: bash - # run: sudo apt -y install musl-tools - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.6 - - - name: Generate version - id: gen-version - shell: bash - run: echo 'VERSION=0.0.0-${{ github.sha }}' >> $GITHUB_OUTPUT - - - name: Replace version - uses: ./.github/actions/replace-version - with: - version: ${{ steps.gen-version.outputs.VERSION }} - - - name: Build Psh - uses: ./.github/actions/build - with: - target: ${{ matrix.target }} - release: false - -# - name: Generate artifacts name -# id: gen-name -# shell: bash -# run: echo 'NAME=psh-dev-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.toolchain }}' >> $GITHUB_OUTPUT - -#- name: Upload artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: ${{ steps.gen-name.outputs.NAME }} -#path: ./target/${{ matrix.target }}/debug/psh -#if-no-files-found: error diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml deleted file mode 100644 index d6a7047..0000000 --- a/.github/workflows/build-release.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Build / Release - -on: - push: - tags: - - v*.*.* - -jobs: - build-release: - name: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.toolchain }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - # we only need to support linux - os: [ubuntu-20.04, ubuntu-latest] - # TODO: do we want to support musl? - target: [x86_64-unknown-linux-gnu] - # make sure it runs on latest stable rust - toolchain: [stable] - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - submodules: true - - - name: Install Toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.toolchain }} - - - name: Install Protoc - uses: arduino/setup-protoc@v3 - - # - name: Setup musl-tools - # if: matrix.target == 'x86_64-unknown-linux-musl' - # shell: bash - # run: sudo apt -y install musl-tools - - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.toolchain }} - - - name: Generate version - id: gen-version - shell: bash - run: echo 'VERSION=${{ github.ref_name }}' | sed 's/v//' >> $GITHUB_OUTPUT - - - name: Replace version - uses: ./.github/actions/replace-version - with: - version: ${{ steps.gen-version.outputs.VERSION }} - - - name: Run build - uses: ./.github/actions/build - with: - target: ${{ matrix.target }} - release: true - - - name: Generate artifacts name - id: gen-name - shell: bash - run: echo 'NAME=psh-${{ steps.gen-version.outputs.VERSION }}-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.toolchain }}' >> $GITHUB_OUTPUT - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.gen-name.outputs.NAME }} - path: ./target/${{ matrix.target }}/release/psh - if-no-files-found: error - - - name: Archive binary - uses: ./.github/actions/make-archive - with: - files: ./target/${{ matrix.target }}/release/psh - out: ${{ steps.gen-name.outputs.NAME }}.zip - - - name: Create GitHub release - uses: softprops/action-gh-release@v2 - with: - files: ${{ steps.gen-name.outputs.NAME }}.zip diff --git a/.github/workflows/build-check.yml b/.github/workflows/build.yml similarity index 58% rename from .github/workflows/build-check.yml rename to .github/workflows/build.yml index cc4516b..7efe85f 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build.yml @@ -1,24 +1,28 @@ -name: Check if Psh can build +name: Build on: - push: pull_request: + types: + - opened + - reopened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: RUST_BACKTRACE: 1 jobs: build: - name: Build Check runs-on: ${{ matrix.os }} + strategy: matrix: - # we only need to support linux - os: [ubuntu-20.04, ubuntu-latest] + os: [ubuntu-22.04] # TODO: do we want to support musl? target: [x86_64-unknown-linux-gnu] - # make sure it runs on latest stable rust - toolchain: [stable] env: SCCACHE_GHA_ENABLED: "true" @@ -27,22 +31,21 @@ jobs: steps: - uses: actions/checkout/@v4 - - name: Install Toolchain + - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ matrix.toolchain }} - components: clippy + toolchain: 1.81.0 - - name: Show environment information + - name: Show env uses: ./.github/actions/show-env - - name: Install Protoc + - name: Setup protoc uses: arduino/setup-protoc@v3 - - name: Run sccache-cache + - name: Setup build cache uses: mozilla-actions/sccache-action@v0.0.6 - - name: Build Psh + - name: Build uses: ./.github/actions/build with: target: ${{ matrix.target }} diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index a88bba6..cf82f7f 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -1,21 +1,26 @@ name: Clippy on: - push: pull_request: + types: + - opened + - reopened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: RUST_BACKTRACE: 1 jobs: clippy: - name: Clippy rust runs-on: ${{ matrix.os }} + strategy: matrix: - os: [ubuntu-latest] - # make sure it runs on latest stable rust - toolchain: [stable] + os: [ubuntu-22.04] env: SCCACHE_GHA_ENABLED: "true" @@ -24,20 +29,20 @@ jobs: steps: - uses: actions/checkout/@v4 - - name: Install Toolchain + - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ matrix.toolchain }} + toolchain: 1.81.0 components: clippy - - name: Show environment information + - name: Show env uses: ./.github/actions/show-env - - name: Install Protoc + - name: Setup protoc uses: arduino/setup-protoc@v3 - - name: Run sccache-cache + - name: Setup build cache uses: mozilla-actions/sccache-action@v0.0.6 - - name: Run clippy + - name: Clippy uses: ./.github/actions/clippy diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index a794ca7..1260e36 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -1,8 +1,15 @@ name: Rustfmt on: - push: pull_request: + types: + - opened + - reopened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: rustfmt: @@ -11,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-22.04] steps: - name: Checkout @@ -20,13 +27,13 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Setup Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@master with: - toolchain: stable + toolchain: 1.81.0 components: rustfmt - - name: Show environment information + - name: Show env uses: ./.github/actions/show-env - - name: Check fmt + - name: Rustfmt uses: ./.github/actions/rustfmt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1dba064..f4697e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,51 +1,56 @@ name: Test on: - push: pull_request: + types: + - opened + - reopened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: RUST_BACKTRACE: 1 jobs: test: - name: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.toolchain }} runs-on: ${{ matrix.os }} - env: - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: "sccache" strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-latest] - target: [x86_64-unknown-linux-gnu] - toolchain: [stable] + os: [ubuntu-22.04] + + env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" steps: - uses: actions/checkout/@v4 - - name: Rust Toolchain + - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ matrix.toolchain }} + toolchain: 1.81.0 - name: Install cargo-binstall uses: taiki-e/install-action@v2 with: tool: cargo-binstall - - name: install cargo-component + - name: Install cargo-component run: cargo binstall cargo-component - - name: Show environment information + - name: Show env uses: ./.github/actions/show-env - - name: Run sccache-cache + - name: Setup build cache uses: mozilla-actions/sccache-action@v0.0.6 - - name: Install Protoc + - name: Setup protoc uses: arduino/setup-protoc@v3 - - name: Run Test + - name: Test uses: ./.github/actions/test