name: Continuous Integration
on:
push:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: self-hosted
permissions:
contents: read
deployments: write
pull-requests: write
env:
RUSTC_WRAPPER: /usr/bin/sccache
CARGO_INCREMENTAL: 0
SCCACHE_DIR: /var/lib/github-actions/.cache
steps:
- uses: actions/checkout@v2
- name: Comment deploy start
if: github.event_name != 'push'
uses: mshick/add-pr-comment@v2
continue-on-error: true
with:
message-id: cloudflare-deploy
message: |
### ๐ง Deploy Preview building...
| Name | Link |
|---------------------------------|------------------------|
|๐จ Latest commit | ${{ github.sha }} |
|๐ Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
---
- name: ๐ง Set up Node
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: ๐ง Install Node dependencies
run: |
cd frontend
npm ci
- name: ๐ผ Update Rust to latest stable
run: |
rustc --version
rustup update stable
rustc --version
- name: ๐ Build Graphite web code
env:
NODE_ENV: production
run: |
cd frontend
mold -run npm run build
- name: Publish
id: cloudflare
uses: cloudflare/pages-action@1
continue-on-error: true
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: graphite-dev # e.g. 'my-project'
directory: frontend/dist # e.g. 'dist'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Comment deploy url
uses: mshick/add-pr-comment@v2
continue-on-error: true
with:
message-id: cloudflare-deploy
message: |
### โ
Deploy Preview ready!
| Name | Link |
|---------------------------------|------------------------|
|๐จ Latest commit | ${{ github.sha }} |
|๐ Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
|๐ Deploy Preview Url | [${{ steps.cloudflare.outputs.url }}](${{ steps.cloudflare.outputs.url }}) |
|๐ณ Environment | ${{ steps.cloudflare.outputs.environment }} |
---
- name: ๐ Lint Graphite web formatting
env:
NODE_ENV: production
run: |
cd frontend
# npm run lint
echo "๐ฅ Frontend linting is temporarily disabled until it can be set up again with Svelte ๐ฅ"
- name: ๐ฌ Check Rust formatting
run: |
mold -run cargo fmt --all -- --check
- name: ๐ฆ Build Rust code
run: |
mold -run cargo build
- name: ๐งช Run Rust tests
run: |
mold -run cargo nextest run
miri:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: ๐งช Run Rust miri
run: |
mold -run cargo +nightly miri nextest run -j32
cargo-deny:
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- 'crate security advisories'
- 'crate license compatibility'
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'crate security advisories' }}
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
if: matrix.checks == 'crate security advisories'
with:
command: check advisories
- uses: EmbarkStudios/cargo-deny-action@v1
if: matrix.checks == 'crate license compatibility'
with:
command: check bans licenses sources