Skip to content

Commit

Permalink
Merge pull request #1 from JuliaComputing/sf/add_ci
Browse files Browse the repository at this point in the history
Add GHA-based CI
  • Loading branch information
staticfloat authored Nov 17, 2022
2 parents ee0e1eb + ef1d4a3 commit 9b6f630
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 148 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This file gratefully stolen from https://github.com/FedericoPonzi/rust-ci/
name: CI

on:
pull_request:
push:
branches:
- master
tags:
- 'v*.*.*'

jobs:
style:
name: Check Style
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1

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

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


test:
name: Test
needs: [style]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1

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

- name: Build
shell: bash
run: "make"

- name: Test
shell: bash
run: "make test"

create-release:
name: deploy
needs: [test]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
strategy:
matrix:
target: [ aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf, i686-unknown-linux-gnu, i686-unknown-linux-musl, powerpc64-unknown-linux-gnu, powerpc64le-unknown-linux-gnu, arm-unknown-linux-gnueabi, x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl ]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}

- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}

- name: Package
shell: bash
run: |
mv target/${{ matrix.target }}/release/authorized-keys-github authorized-keys-github-${{ matrix.target }}
- name: Publish
uses: softprops/action-gh-release@v1
# TODO: if any of the build step fails, the release should be deleted.
with:
files: 'authorized-keys-github-*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 9b6f630

Please sign in to comment.