Upgrade vendor #137
Workflow file for this run
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 | |
CLICOLOR_FORCE: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
./target | |
key: test-cargo-registry | |
- name: List | |
run: find ./ | |
- name: Run units/functionals tests | |
run: echo $TERM && cargo test --verbose | |
- name: Run e2e tests | |
run: ./e2e-test.sh | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- TARGET: x86_64-unknown-linux-gnu | |
OS: ubuntu-latest | |
- TARGET: x86_64-apple-darwin | |
OS: macos-latest | |
needs: test | |
runs-on: ${{ matrix.OS }} | |
env: | |
NAME: cultura | |
TARGET: ${{ matrix.TARGET }} | |
OS: ${{ matrix.OS }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
./target | |
key: build-cargo-registry-${{matrix.TARGET}} | |
- name: List | |
run: find ./ | |
- name: Install rust target | |
run: rustup target add $TARGET | |
- name: Run build | |
run: cargo build --release --verbose --target $TARGET | |
- name: List target | |
run: find ./target | |
- name: Compress | |
run: | | |
mkdir -p ./artifacts | |
EXEC=$NAME | |
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then | |
TAG=$GITHUB_REF_NAME | |
else | |
TAG=$GITHUB_SHA | |
fi | |
mv ./target/$TARGET/release/$EXEC ./$EXEC | |
tar -czf ./artifacts/$NAME-$TARGET-$TAG.tar.gz $EXEC | |
- name: Archive artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: result | |
path: | | |
./artifacts | |
deploy-binary: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: result | |
path: ./artifacts | |
- name: List | |
run: find ./artifacts | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./artifacts/*.tar.gz | |
permissions: | |
contents: write | |
build-and-deploy-docker: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: antham/cultura:${{ github.head_ref || github.ref_name }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: ${{ github.ref_name == 'master' }} | |
tags: antham/cultura:latest | |
deploy-cargo-package: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Publish on cargo | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: cargo publish --token ${CRATES_TOKEN} | |
env: | |
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} |