-
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.
* Add github actions * Add missing actions references * Remove use of unmaintained action * Fix matrix strategy and added dependencies for `aarch64-unknown-linux-gnu` compilation * Add caching, calls to rustfmt, and improved descriptions * Fix lint errors * Add release action * Change releasae action triggers for testing * Modify path * Fix file path * Fix file path * Fix file path * Add ceation of release * Add missing checkout action * Fix permissions * Remove upload of binaries * Fix typo * Add upload of binaries to release * Fix upload binary path * Fix download of artifacts * Add debug steps * Fix binary path * Rename artifact before uploading asset to release * Add retention rules to upload and remove windows upload for testing * Fix download path * Add prerelease to releases and change trigger * Implement reusable workflows to reduce code duplication
- Loading branch information
Showing
6 changed files
with
162 additions
and
11 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,2 @@ | ||
[target.aarch64-unknown-linux-gnu] | ||
linker = "aarch64-linux-gnu-gcc" |
Empty file.
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,69 @@ | ||
name: Build and lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_call: | ||
inputs: | ||
for_release: | ||
type: boolean | ||
description: | | ||
Mark if additional steps required for a release, like uploading artifacts, should be executed | ||
required: true | ||
default: false | ||
version: | ||
type: string | ||
description: Project version used for naming artifacts | ||
required: true | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os-target: | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- os: ubuntu-latest | ||
target: aarch64-unknown-linux-gnu | ||
- os: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
- os: macos-latest | ||
target: x86_64-apple-darwin | ||
runs-on: ${{ matrix.os-target.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: 1.70.0 | ||
targets: ${{ matrix.os-target.target }} | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Install aarch64-unknown-linux-gnu requisites | ||
run: sudo apt-get install g++-aarch64-linux-gnu -y | ||
if: matrix.os-target.target == 'aarch64-unknown-linux-gnu' | ||
- name: Run cargo check | ||
run: cargo build --release --target ${{ matrix.os-target.target }} | ||
- name: Upload artifacts for reuse in release job | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ inputs.for_release }} | ||
with: | ||
name: arcanist_${{ inputs.version }}_${{ matrix.os-target.target }} | ||
path: ${{ github.workspace }}/target/${{ matrix.os-target.target }}/release/arcanist${{ matrix.os-target.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | ||
if-no-files-found: error | ||
retention-days: 5 | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: 1.70.0 | ||
components: clippy,rustfmt | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Run clippy | ||
run: cargo clippy -- -D warnings | ||
- name: Run rustfmt | ||
run: cargo fmt --all -- --check |
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,80 @@ | ||
name: Create release | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
jobs: | ||
setup-validation: | ||
outputs: | ||
version: ${{ steps.gather-version.outputs.version }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Extract version from Cargo.toml | ||
id: gather-version | ||
run: echo version=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "arcanist").version') >> $GITHUB_OUTPUT | ||
- name: Ensure release does not already exist | ||
run: | | ||
git fetch origin &> /dev/null | ||
version=${{ steps.gather-version.outputs.version }} | ||
if [[ -n "$(git tag -l v${version})" ]]; then | ||
echo "A release '${version}' already exists." >&2 | ||
exit 1 | ||
else | ||
echo "Tag 'v${version}' will be created" | ||
fi | ||
build-lint: | ||
uses: ./.github/workflows/build_lint.yml | ||
needs: setup-validation | ||
with: | ||
for_release: true | ||
version: ${{ needs.setup-validation.outputs.version }} | ||
release: | ||
needs: [setup-validation, build-lint] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Generate release notes | ||
run: | | ||
sed 's/{version}/${{ needs.setup-validation.outputs.version }}/g' ${{ github.workspace }}/.github/release_notes.template \ | ||
> ${{ github.workspace }}/.github/release_notes.txt | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
id: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
generate_release_notes: true | ||
name: Arcanist - ${{ needs.setup-validation.outputs.version }} | ||
tag_name: v${{ needs.setup-validation.outputs.version }} | ||
body_path: ${{ github.workspace }}/.github/release_notes.txt | ||
target_commitish: ${{ github.base_ref }} | ||
prerelease: true | ||
upload-to-release: | ||
needs: [setup-validation, build-lint, release] | ||
permissions: | ||
contents: write | ||
strategy: | ||
matrix: | ||
target: | ||
- x86_64-unknown-linux-gnu | ||
- aarch64-unknown-linux-gnu | ||
- x86_64-pc-windows-msvc | ||
- x86_64-apple-darwin | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: arcanist_${{ needs.setup-validation.outputs.version }}_${{ matrix.target }} | ||
path: ${{ github.workspace }}/target/${{ matrix.target }}/release | ||
- name: Upload arcanist binary to release | ||
run: | | ||
mv ${{ github.workspace }}/target/${{ matrix.target }}/release/arcanist${{ matrix.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} \ | ||
arcanist_${{ needs.setup-validation.outputs.version }}_${{ matrix.target }}${{ matrix.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | ||
gh release upload v${{ needs.setup-validation.outputs.version }} \ | ||
arcanist_${{ needs.setup-validation.outputs.version }}_${{ matrix.target }}${{ matrix.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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