summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ivy III <rivy.dev@gmail.com>2019-11-20 19:07:59 -0600
committerPierre Peltier <dev@halium.fr>2019-12-04 11:09:11 +0100
commitc3ad2ff5fcae87f5972274ac13429c8e86aaf9d7 (patch)
treee80cc94fc39775b15d2f16303b4f1a049106fefe
parenta85dc11a47b7ffefd0647f1864639f2fd6983274 (diff)
maint/cicd ~ add testing and release deployment to GHA
-rw-r--r--.github/workflows/CD.yml65
-rw-r--r--.github/workflows/CICD.yml150
2 files changed, 150 insertions, 65 deletions
diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml
deleted file mode 100644
index f08bf66..0000000
--- a/.github/workflows/CD.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-name: CD
-
-# spell-checker:ignore musl executables toolchain MSVC
-
-on: [push, pull_request]
-
-jobs:
- build_linux:
- name: Build (linux)
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- target:
- - i686-unknown-linux-gnu
- - x86_64-unknown-linux-gnu
- - x86_64-unknown-linux-musl
- # - i686-pc-windows-gnu
- # - x86_64-pc-windows-gnu
- steps:
- - uses: actions/checkout@v1
- - uses: actions-rs/toolchain@v1
- with:
- toolchain: stable
- target: ${{ matrix.target }}
- override: true
- - uses: actions-rs/cargo@v1
- with:
- use-cross: true
- command: build
- args: --release --target=${{ matrix.target }}
- - name: Archive executables as artifacts
- uses: actions/upload-artifact@master
- with:
- name: lsd-${{ matrix.target }}
- path: target/${{ matrix.target }}/release/lsd
-
- build_windows:
- name: Build (windows)
- runs-on: windows-latest
- strategy:
- fail-fast: false
- matrix:
- target:
- # - i686-pc-windows-gnu
- - i686-pc-windows-msvc
- # - x86_64-pc-windows-gnu
- - x86_64-pc-windows-msvc
- steps:
- - uses: actions/checkout@v1
- - uses: actions-rs/toolchain@v1
- with:
- toolchain: stable
- target: ${{ matrix.target }}
- override: true
- - uses: actions-rs/cargo@v1
- with:
- use-cross: true
- command: build
- args: --release --target=${{ matrix.target }}
- - name: Archive executables as artifacts
- uses: actions/upload-artifact@master
- with:
- name: lsd-${{ matrix.target }}.exe
- path: target/${{ matrix.target }}/release/lsd.exe
diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml
new file mode 100644
index 0000000..d1f4a66
--- /dev/null
+++ b/.github/workflows/CICD.yml
@@ -0,0 +1,150 @@
+name: CICD
+
+# spell-checker:ignore CICD MSVC clippy mkdir musl rustfmt softprops toolchain
+
+env:
+ PROJECT_NAME: lsd
+
+on: [push, pull_request]
+
+jobs:
+ build_linux:
+ name: Build (linux)
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ target:
+ - i686-unknown-linux-gnu
+ - x86_64-unknown-linux-gnu
+ - x86_64-unknown-linux-musl
+ # - i686-pc-windows-gnu
+ # - x86_64-pc-windows-gnu
+ env:
+ EXE_suffix: ""
+ steps:
+ - uses: actions/checkout@v1
+ - name: Parse any commit tag
+ id: parse_tag
+ shell: bash
+ run: |
+ echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
+ echo ::set-output name=PKG::${{ env.PROJECT_NAME }}-${GITHUB_REF#refs/tags/}-${{ matrix.target }}${{ env.EXE_suffix }}
+ - name: Create all needed build/work directories
+ shell: bash
+ run: mkdir -p 'package'
+ - name: Install `rust` toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+ target: ${{ matrix.target }}
+ override: true
+ profile: minimal # minimal component installation (ie, no documentation)
+ components: rustfmt, clippy
+ - name: Build
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: true
+ command: build
+ args: --release --target=${{ matrix.target }}
+ - name: Test
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: true
+ command: test
+ args: --target=${{ matrix.target }}
+ - name: "`fmt` testing"
+ uses: actions-rs/cargo@v1
+ with:
+ command: fmt
+ args: --all -- --check
+ - name: "`clippy` testing"
+ uses: actions-rs/cargo@v1
+ with:
+ command: clippy
+ args: -- -D warnings
+ - name: Archive executable artifacts
+ uses: actions/upload-artifact@master
+ with:
+ name: ${{ env.PROJECT_NAME }}-${{ matrix.target }}
+ path: target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}${{ env.EXE_suffix }}
+ - name: Package
+ shell: bash
+ run: cp 'target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}${{ env.EXE_suffix }}' 'package/${{ steps.get_tag.outputs.PKG }}'
+ - name: Publish
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/v')
+ with:
+ files: package/${{ steps.get_tag.outputs.PKG }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ build_windows:
+ name: Build (windows)
+ runs-on: windows-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ target:
+ # - i686-pc-windows-gnu
+ - i686-pc-windows-msvc
+ # - x86_64-pc-windows-gnu
+ - x86_64-pc-windows-msvc
+ env:
+ EXE_suffix: .exe
+ steps:
+ - uses: actions/checkout@v1
+ - name: Parse any commit tag
+ id: parse_tag
+ shell: bash
+ run: |
+ echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
+ echo ::set-output name=PKG::${{ env.PROJECT_NAME }}-${GITHUB_REF#refs/tags/}-${{ matrix.target }}${{ env.EXE_suffix }}
+ - name: Create all needed build/work directories
+ shell: bash
+ run: mkdir -p 'package'
+ - name: Install `rust` toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+ target: ${{ matrix.target }}
+ override: true
+ profile: minimal # minimal component installation (ie, no documentation)
+ components: rustfmt, clippy
+ - name: Build
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: true
+ command: build
+ args: --release --target=${{ matrix.target }}
+ - name: Test
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: true
+ command: test
+ args: --target=${{ matrix.target }}
+ - name: "`fmt` testing"
+ uses: actions-rs/cargo@v1
+ with:
+ command: fmt
+ args: --all -- --check
+ - name: "`clippy` testing"
+ uses: actions-rs/cargo@v1
+ with:
+ command: clippy
+ args: -- -D warnings
+ - name: Archive executable artifacts
+ uses: actions/upload-artifact@master
+ with:
+ name: ${{ env.PROJECT_NAME }}-${{ matrix.target }}
+ path: target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}${{ env.EXE_suffix }}
+ - name: Package
+ shell: bash
+ run: cp 'target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}${{ env.EXE_suffix }}' 'package/${{ steps.get_tag.outputs.PKG }}'
+ - name: Publish
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/v')
+ with:
+ files: package/${{ steps.get_tag.outputs.PKG }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}