forked from torrust/torrust-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request torrust#65 from torrust/workflow-59-auto-add-compi…
…led-binaries-for-macos-linux-and-win64-on-release workflow: added a test, build and release workflow
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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