Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
update action
Browse files Browse the repository at this point in the history
  • Loading branch information
s5suzuki committed Jul 26, 2024
1 parent 72aebc7 commit b655a6b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 111 deletions.
7 changes: 5 additions & 2 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ runs:
shell: bash
if: inputs.os == 'macos-latest'
run: |
brew install git cmake ninja
brew install ninja
- name: install dependencies
shell: bash
if: inputs.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libfreetype6-dev libfontconfig1-dev
- name: setup cache
uses: swatinem/rust-cache@v2
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ updates:
directory: "/"
schedule:
interval: "weekly"
target-branch: "develop"
target-branch: "main"
19 changes: 19 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Auto merge

on:
pull_request:
branches:
- main

permissions:
pull-requests: write
contents: write

jobs:
auto-merge:
runs-on: ubuntu-latest
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: gh pr merge --merge --auto "$PR_URL"
100 changes: 37 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,83 @@
name: build

on:
push:
branches:
- 'develop'
pull_request:
types: [opened, reopened, review_requested]
pull_request: {}
merge_group:
branches: [ "main" ]

jobs:
check-src:

changed-files:
name: changed-files
runs-on: ubuntu-latest
name: check if src files changed
outputs:
status: ${{ steps.changed-files.outputs.modified_files }}
src: ${{ steps.changed-files-yaml.outputs.src_any_changed }}
gpu: ${{ steps.changed-files-yaml.outputs.gpu_any_changed }}
steps:
- uses: actions/checkout@v4
- uses: tj-actions/changed-files@v42
id: changed-files
- id: changed-files-yaml
uses: tj-actions/changed-files@v44
with:
files: |
.github/actions/setup-build/action.yml
.github/workflows/build.yml
./**/*.comp
./**/*.rs
./*.toml
files_yaml: |
src:
- '**/*.rs'
- '**/Cargo.toml'
gpu:
- '**/*.rs'
- '**/Cargo.toml'
- '**/*.comp'
build-src:
needs: check-src
name: build-src-${{ matrix.os }}
test:
needs: changed-files
if: ${{ needs.changed-files.outputs.src == 'true' }}
name: test-on-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Rust cache
if: needs.check-src.outputs.status
uses: swatinem/rust-cache@v2

- name: Setup
if: needs.check-src.outputs.status
uses: ./.github/actions/setup-build
- uses: ./.github/actions/setup-build
with:
os: ${{ matrix.os }}
shaderc: false

- name: Test src on ${{ matrix.os }}
if: needs.check-src.outputs.status
run: |
- run: |
cargo build --features "plotters python"
cargo test --features "plotters python"
shell: bash
build-src-with-gpu:
needs: check-src
name: build-src-${{ matrix.os }}-with-gpu
test-gpu:
needs: changed-files
if: ${{ needs.changed-files.outputs.gpu == 'true' }}
name: test-on-${{ matrix.os }}-with-gpu
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Rust cache
if: needs.check-src.outputs.status
uses: swatinem/rust-cache@v2

- name: Setup
if: needs.check-src.outputs.status
uses: ./.github/actions/setup-build
- uses: ./.github/actions/setup-build
with:
os: ${{ matrix.os }}
shaderc: true

- name: Test src on ${{ matrix.os }}
if: needs.check-src.outputs.status
run: |
- run: |
cargo build --features "plotters python gpu"
cargo test --features "plotters python gpu"
shell: bash
lint-src:
needs: check-src
name: lint-src
lint:
needs: changed-files
if: ${{ needs.changed-files.outputs.src == 'true' }}
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup
if: needs.check-src.outputs.status
uses: ./.github/actions/setup-build
- uses: ./.github/actions/setup-build
with:
os: ubuntu-latest
shaderc: true

- name: Rust cache
if: needs.check-src.outputs.status
uses: swatinem/rust-cache@v2

- name: lint src
if: needs.check-src.outputs.status
run: |
- run: |
cargo clippy --features "plotters python" -- -D warnings
cargo clippy --features "plotters python gpu" -- -D warnings
cargo clippy --features "plotters python gpu" -- -D warnings
47 changes: 6 additions & 41 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,22 @@
name: Coverage

on:
push:
branches:
- 'develop'

jobs:
check-src:
runs-on: ubuntu-latest
name: check if src files changed
outputs:
status: ${{ steps.changed-files.outputs.modified_files }}
steps:
- uses: actions/checkout@v4
- uses: tj-actions/changed-files@v42
id: changed-files
with:
files: |
.github/workflows/coverage.yml
.github/actions/setup-build/action.yml
.github/workflows/build.yml
./**/*.comp
./**/*.rs
./*.toml
merge_group:
branches: [ "main" ]

coverage:
needs: check-src
if: needs.check-src.outputs.status
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4

- name: Setup
if: needs.check-src.outputs.status
uses: ./.github/actions/setup-build
- uses: ./.github/actions/setup-build
with:
os: ubuntu-latest
shaderc: false

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Rust cache
if: needs.check-src.outputs.status
uses: swatinem/rust-cache@v2

- name: Generate code coverage
run: |
cargo llvm-cov --lib --features "python plotters" --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --lib --features "python plotters" --lcov --output-path lcov.info
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ on:
tags:
- 'v*'


jobs:
build:
name: publish-src
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: publish to carate.io
run: |
cargo publish --no-verify --token ${{ secrets.CRATEIO_TOKEN }}
- run: cargo publish --no-verify --token ${{ secrets.CRATEIO_TOKEN }}

0 comments on commit b655a6b

Please sign in to comment.