52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITEA }}
|
|
|
|
- name: Configure git to use HTTPS for submodules
|
|
run: |
|
|
git config --global url."https://${{ secrets.GITEA }}@git.rcjohnstone.com/".insteadOf "ssh://connor@git.rcjohnstone.com:2222/"
|
|
git submodule update --init --recursive
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
|
|
- run: cargo fmt --check
|
|
|
|
- run: cargo clippy --workspace -- -D warnings
|
|
|
|
- run: cargo build --workspace
|
|
|
|
- run: cargo test --workspace
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
needs: check
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITEA }}
|
|
|
|
- name: Configure git to use HTTPS for submodules
|
|
run: |
|
|
git config --global url."https://${{ secrets.GITEA }}@git.rcjohnstone.com/".insteadOf "ssh://connor@git.rcjohnstone.com:2222/"
|
|
git submodule update --init --recursive
|
|
|
|
- name: Log in to container registry
|
|
run: echo "${{ secrets.GITEA }}" | docker login git.rcjohnstone.com -u connor --password-stdin
|
|
|
|
- name: Build and push
|
|
run: |
|
|
docker build -t git.rcjohnstone.com/connor/shanty:latest -t git.rcjohnstone.com/connor/shanty:${{ github.sha }} .
|
|
docker push git.rcjohnstone.com/connor/shanty:latest
|
|
docker push git.rcjohnstone.com/connor/shanty:${{ github.sha }}
|