Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #489

Closed
wants to merge 13 commits into from
12 changes: 5 additions & 7 deletions .github/workflows/cargo-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ on:
jobs:
security_audit:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: checkout
uses: actions/[email protected]

- name: cargo audit
uses: actions-rs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: actions-rust-lang/audit@v1
87 changes: 21 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,80 +9,35 @@ on:
name: CI

jobs:
check:
rust:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v2

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
# Set linting rules for clippy
args: --all-targets --all-features
- name: checkout
uses: actions/checkout@v4
- name: install rust
uses: dtolnay/rust-toolchain@stable
- name: cache dependencies
uses: Swatinem/rust-cache@v2
- name: check formatting
run: cargo fmt --all -- --check
- name: cargo check
run: cargo check --workspace --locked
- name: clippy
run: cargo clippy --all-targets --all-features

test-plan:
name: Tests
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
outputs:
matrix: ${{ steps.docker-prep.outputs.matrix }}
if: "!contains(github.event.head_commit.message, '(cargo-release)')"
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v2

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
- name: checkout
uses: actions/checkout@v4
- name: install rust
uses: dtolnay/rust-toolchain@stable
- name: cahce dependencies
Milo123459 marked this conversation as resolved.
Show resolved Hide resolved
uses: Swatinem/rust-cache@v2
- name: test
run: cargo test
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install the cosign tool
# https://github.com/sigstore/cosign-installer
Expand Down
38 changes: 22 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
echo "version is: ${{ env.CLI_VERSION }}"

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand Down Expand Up @@ -90,24 +90,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true

- name: Build release binary
uses: actions-rs/cargo@v1
- name: Setup rust
uses: dtolnay/rust-toolchain@stable
with:
command: build
args: --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.use-cross || matrix.os == 'ubuntu-latest' }}
targets: ${{ matrix.os }}

- run: cargo build --release --locked --target ${{ matrix.target }}

- name: Prepare binaries (zip) [Windows]
if: matrix.os == 'windows-latest'
Expand Down Expand Up @@ -167,3 +158,18 @@ jobs:
download-url: https://github.com/railwayapp/cli/releases/latest/download/railway-${{ needs.create-release.outputs.railway_version }}-${{ matrix.target }}.tar.gz
env:
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
publish-crate:
Milo123459 marked this conversation as resolved.
Show resolved Hide resolved
name: Publish new version on crates.io
needs: ["create-release"]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Publish
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
node_modules
bin/railway
bin/railway
.DS_Store