Skip to content

feat: support pull request opened event #46

feat: support pull request opened event

feat: support pull request opened event #46

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
jobs:
lints:
name: Format & Lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
key: "lints"
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run cargo fmt
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: clippy
args: -- -D warnings
- uses: Swatinem/rust-cache@v1
arch-matrix:
needs: [lints]
runs-on: ubuntu-latest
strategy:
matrix:
target: [ "armv7-unknown-linux-musleabihf", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl" ]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
key: "${{ matrix.os }}-${{ matrix.target }}"
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
target: ${{ matrix.target }}
- name: Cargo build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target ${{ matrix.target }} --release
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: ./target/${{ matrix.target }}/release/cocogitto_github_app
docker-build:
name: Update docker multi-arch latest
needs: [ arch-matrix ]
runs-on: ubuntu-latest
steps:
- name: Install docker buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout sources
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: ~/artifacts
- name: Copy artifacts to build dir
run: |
mkdir -p target/x86_64-unknown-linux-musl/release/
cp -r /home/runner/artifacts/x86_64-unknown-linux-musl/cocogitto_github_app target/x86_64-unknown-linux-musl/release/cocogitto_github_app
chmod +x target/x86_64-unknown-linux-musl/release/cocogitto_github_app
mkdir -p target/aarch64-unknown-linux-musl/release/
cp -r /home/runner/artifacts/aarch64-unknown-linux-musl/cocogitto_github_app target/aarch64-unknown-linux-musl/release/cocogitto_github_app
chmod +x target/aarch64-unknown-linux-musl/release/cocogitto_github_app
mkdir -p target/armv7-unknown-linux-musleabihf/release/
cp -r /home/runner/artifacts/armv7-unknown-linux-musleabihf/cocogitto_github_app target/armv7-unknown-linux-musleabihf/release/cocogitto_github_app
chmod +x target/armv7-unknown-linux-musleabihf/release/cocogitto_github_app
- if: ${{ github.ref_type == 'tag' }}
name: Update multi-arch container latest
run: |
docker buildx build \
--push --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \
-t ghcr.io/cocogitto/cocogitto-bot:${{ github.ref_name }} .
- if: ${{ github.ref_type == 'branch' }}
name: Update multi-arch container latest
run: |
docker buildx build \
--push --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \
-t ghcr.io/cocogitto/cocogitto-bot:latest .