Merge pull request #69 from torrust/develop #1
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
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Run databases | |
working-directory: ./tests | |
run: docker-compose up -d | |
- name: Wait for databases to start | |
run: sleep 15s | |
shell: bash | |
- uses: Swatinem/rust-cache@v1 | |
- name: Run tests | |
run: cargo test | |
tag: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Determine tag | |
id: tag | |
run: echo "::set-output name=release_tag::v$(grep -m 1 'version' Cargo.toml | awk '{print $3}' | tr -d '/"')" | |
outputs: | |
release_tag: ${{ steps.tag.outputs.release_tag }} | |
build: | |
needs: tag | |
name: Build ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-pc-windows-gnu | |
archive: zip | |
name: ${{ github.event.repository.name }}_${{ needs.tag.outputs.release_tag }}_x86_64-pc-windows-gnu | |
- target: x86_64-unknown-linux-musl | |
archive: tar.gz tar.xz | |
name: ${{ github.event.repository.name }}_${{ needs.tag.outputs.release_tag }}_x86_64-unknown-linux-musl | |
- target: x86_64-apple-darwin | |
archive: zip | |
name: ${{ github.event.repository.name }}_${{ needs.tag.outputs.release_tag }}_x86_64-apple-darwin | |
steps: | |
- uses: actions/checkout@master | |
- name: Compile builds | |
id: compile | |
uses: rust-build/[email protected] | |
with: | |
RUSTTARGET: ${{ matrix.target }} | |
ARCHIVE_TYPES: ${{ matrix.archive }} | |
ARCHIVE_NAME: ${{ matrix.name }} | |
UPLOAD_MODE: none | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: torrust-index-backend | |
path: | | |
${{ steps.compile.outputs.BUILT_ARCHIVE }} | |
${{ steps.compile.outputs.BUILT_CHECKSUM }} | |
release: | |
needs: [tag, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download builds | |
uses: actions/download-artifact@v2 | |
with: | |
name: torrust-index-backend | |
path: torrust-index-backend | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
tag_name: ${{ needs.tag.outputs.release_tag }} | |
files: | | |
torrust-index-backend/* | |
LICENSE |