Skip to content

Commit

Permalink
Merge pull request torrust#65 from torrust/workflow-59-auto-add-compi…
Browse files Browse the repository at this point in the history
…led-binaries-for-macos-linux-and-win64-on-release

workflow: added a test, build and release workflow
  • Loading branch information
mickvandijke authored Sep 12, 2022
2 parents 033d806 + 91ff9a5 commit 837e4ec
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
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
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ The two main applicable license to most of its content are:

- For Media (Images, etc.) -- [cc-by-sa](https://github.com/torrust/torrust-index/blob/main/licensing/cc-by-sa.md)

We make the exception that projects that distribute this work only need to include the name and version of the license, instead of needing to include them verbatim in the package.

If you want to read more about all the licenses and how they apply please refer to the [contributor agreement](https://github.com/torrust/torrust-index/blob/main/licensing/contributor_agreement_v01.md).

0 comments on commit 837e4ec

Please sign in to comment.