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

CI Improvements #160

Closed
1 of 3 tasks
kanerogers opened this issue Feb 16, 2022 · 5 comments · Fixed by #165
Closed
1 of 3 tasks

CI Improvements #160

kanerogers opened this issue Feb 16, 2022 · 5 comments · Fixed by #165
Assignees
Labels
maintenance A maintenance task!

Comments

@kanerogers
Copy link
Collaborator

kanerogers commented Feb 16, 2022

Description

Our CI is good, but it could be better.

The complex thing here is #164, which we'll handle in a separate issue.

TODO

  • Add caching
  • Add clippy
  • Separate test from check
@kanerogers kanerogers added the maintenance A maintenance task! label Feb 16, 2022
@kanerogers kanerogers self-assigned this Feb 16, 2022
@kanerogers kanerogers removed their assignment Feb 16, 2022
@davidkuhta
Copy link
Contributor

davidkuhta commented Feb 21, 2022

Check out the issue-160 branch for a CI workflow based on CI w/ GH actions and Rust using actions-rs:

The run completely successfully, so we'd be able to have clear separation of concerns between clippy and fmt lints and test builds going forward.

on:
  push:
    paths-ignore:
      - '**.md'
  pull_request:
    branches: [main]
    paths-ignore:
      - '**.md'
  workflow_dispatch:

name: CI

env:
  CARGO_TERM_COLOR: always
  RUST_TOOLCHAIN: stable
  TOOLCHAIN_PROFILE: minimal

jobs:
  lints:
    name: Run cargo fmt and cargo clippy
    runs-on: ubuntu-latest
    steps:
      - name: Install ALSA dev
        run: |
          sudo apt-get update
          sudo apt-get install libasound2-dev
      - name: Checkout sources
        uses: actions/checkout@v2
      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: ${{ env.TOOLCHAIN_PROFILE }}
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          override: true
          components: rustfmt, clippy
      - name: Cache
        uses: Swatinem/rust-cache@v1
      - 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
          args: -- -D warnings
  test:
    name: Run cargo test
    runs-on: ubuntu-latest
    steps:
      - name: Install ALSA dev
        run: |
          sudo apt-get update
          sudo apt-get install libasound2-dev
      - name: Checkout sources
        uses: actions/checkout@v2
      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: ${{ env.TOOLCHAIN_PROFILE }}
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          override: true
      - name: Cache
        uses: Swatinem/rust-cache@v1
      - name: Run cargo test --no-run
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: "--no-run"
      - name: Run cargo test
        uses: actions-rs/cargo@v1
        env:
          RUST_TEST_THREADS: 1
        with:
          command: test
          args: "-p hotham --lib"

@kanerogers
Copy link
Collaborator Author

kanerogers commented Feb 21, 2022

Nice work @davidkuhta !

Would you be able to investigate caching here? Potentially we could avoid having to download all the crates and install ALSA each time.

The other option I was thinking was just dockerising the whole CI process.

@davidkuhta
Copy link
Contributor

davidkuhta commented Feb 22, 2022

Nice work @davidkuhta !

Would you be able to investigate caching here? Potentially we could avoid having to download all the crates and install ALSA each time.

The other option I was thinking was just dockerising the whole CI process.

Were you meaning something beyond the cache step?

- name: Cache
  uses: Swatinem/rust-cache@v1

Compare CI Run 5 to CI Run 6, where the the first job "Run cargo fmt and cargo clippy" succeeds in both; it did cache and ran in 40s vs the original 10m50s.

@kanerogers
Copy link
Collaborator Author

kanerogers commented Feb 22, 2022 via email

@kanerogers
Copy link
Collaborator Author

@davidkuhta The swiftshader crap is going to take a bit to get going, so I reckon let's just merge this one in for now and we'll kick the can down the road on the other stuff. I'll create a PR now!

@kanerogers kanerogers changed the title Improve CI Add clippy to CI Feb 23, 2022
@kanerogers kanerogers changed the title Add clippy to CI CI Improvements Feb 23, 2022
kanerogers added a commit that referenced this issue Feb 23, 2022
Repository owner moved this from Todo to Done in 0.2 Release - 3/5/22 Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance A maintenance task!
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants