Skip to content

Commit

Permalink
Merge pull request #1291 from darkdragon-001/refactor-actions
Browse files Browse the repository at this point in the history
Refactor actions
  • Loading branch information
darkdragon-001 authored Aug 6, 2024
2 parents 837e74c + 68958bf commit fc0fd08
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 61 deletions.
62 changes: 5 additions & 57 deletions .github/workflows/build.yaml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
- name: Download dependencies
run: make download-dependencies-axolotl-web

- name: Test
run: make check-axolotl-web

- name: Build
run: make build-axolotl-web

Expand All @@ -36,51 +33,6 @@ jobs:
path: axolotl-web/dist/
retention-days: 1

rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt

- name: Check code format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: install protoc
run: sudo apt-get install protobuf-compiler

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy

- name: Setup CI cache
uses: Swatinem/rust-cache@v2

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

build-axolotl:
name: Build axolotl
runs-on: ubuntu-latest
Expand All @@ -94,12 +46,10 @@ jobs:
run: sudo apt-get install protobuf-compiler

- name: Rust setup
uses: dtolnay/rust-toolchain@stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Rust cache
uses: swatinem/rust-cache@v2
rustflags: ''

- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -185,10 +135,11 @@ jobs:
sudo apt-get update && sudo apt-get install -y --no-install-recommends libgtk-3-dev:arm64 libwebkit2gtk-4.1-dev:arm64 librsvg2-dev:arm64 libayatana-appindicator3-dev:arm64 libssl-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
targets: aarch64-unknown-linux-gnu
target: aarch64-unknown-linux-gnu
rustflags: ''

- name: Setup C compiler, linker and pkgconfig
run: |
Expand All @@ -202,9 +153,6 @@ jobs:
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV
- name: Rust cache
uses: swatinem/rust-cache@v2

- name: Check out code
uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ on:

jobs:
build:
uses: ./.github/workflows/build.yaml
uses: ./.github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
checks: write

jobs:
build:
uses: ./.github/workflows/build.yaml
uses: ./.github/workflows/build.yml
test:
uses: ./.github/workflows/test.yml

# Check if all important jobs passed
# This can be used as required status for branch protection rules.
pr-ok:
runs-on: ubuntu-latest
needs: build
needs:
- build
- test
if: always()
steps:
- name: All tests ok
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build:
uses: ./.github/workflows/build.yaml
uses: ./.github/workflows/build.yml

release:
name: Create release
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Axolotl test pipeline

on:
workflow_call:
workflow_dispatch:

env:
NODE_VERSION: "18.x"

jobs:
test-axolotl-web:
name: Test axolotl-web
runs-on: ubuntu-latest
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Check out code
uses: actions/checkout@v4

- name: Download dependencies
run: make download-dependencies-axolotl-web

- name: Test
run: make check-axolotl-web

rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Rust setup
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
rustflags: ''

- name: Check code format
uses: actions-rust-lang/rustfmt@v1

clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: install protoc
run: sudo apt-get install protobuf-compiler

- name: Rust setup
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy
rustflags: ''

- name: Run clippy lints
uses: auguwu/clippy-action@1.4.0
with:
token: ${{secrets.GITHUB_TOKEN}}

0 comments on commit fc0fd08

Please sign in to comment.