Install just #84
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: [push, pull_request] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install libssl-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev | |
cargo install just | |
- uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
run: rustup show # Don't be fooled by "show", it installs the toolchain in rust-toolchain.toml | |
- name: Run tests | |
run: just test | |
publish: | |
if: github.ref == 'refs/heads/master' | |
env: | |
IMAGE: aelred/tetris-server | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- name: Generate build ID | |
id: prep | |
run: | | |
branch=${GITHUB_REF##*/} | |
sha=${GITHUB_SHA::8} | |
ts=$(date +%s) | |
echo "::set-output name=BUILD_ID::${branch}-${sha}-${ts}" | |
- uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
- uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ env.IMAGE }}:${{ steps.prep.outputs.BUILD_ID }} |