NimPlant v1.4 - Black Hat Edition #28
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
name: Build NimPlant container and test builds | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build-container: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code into workspace directory | |
uses: actions/checkout@v4 | |
- name: Set Docker image tag | |
id: set_tag | |
run: | | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
echo "::set-output name=tag::dev" | |
else | |
echo "::set-output name=tag::latest" | |
fi | |
shell: bash | |
- name: Build Docker container | |
run: docker build . -t ${{ vars.DOCKERHUB_USERNAME }}/nimplant:${{ steps.set_tag.outputs.tag }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push Docker image to Docker Hub | |
run: docker push ${{ vars.DOCKERHUB_USERNAME }}/nimplant:${{ steps.set_tag.outputs.tag }} | |
test-builds: | |
needs: build-container | |
strategy: | |
max-parallel: 2 | |
fail-fast: false | |
matrix: | |
include: | |
- language: "nim" | |
paths: ./client/bin/NimPlant.exe, ./client/bin/NimPlant.dll, ./client/bin/NimPlant.bin, ./client/bin/NimPlant-selfdelete.exe | |
- language: "rust" | |
paths: ./client-rs/bin/nimplant.bin, ./client-rs/bin/nimplant.dll, ./client-rs/bin/nimplant.exe, ./client-rs/bin/nimplant-selfdelete.exe | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code into workspace directory | |
uses: actions/checkout@v4 | |
- name: Set Docker image tag | |
id: set_tag | |
run: | | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
echo "::set-output name=tag::dev" | |
else | |
echo "::set-output name=tag::latest" | |
fi | |
shell: bash | |
- name: Pull Docker image from Docker Hub | |
run: docker pull ${{ vars.DOCKERHUB_USERNAME }}/nimplant:${{ steps.set_tag.outputs.tag }} | |
- name: Copy example configuration | |
run: cp config.toml.example config.toml | |
- name: Compile binaries using Docker | |
run: docker run -v ${PWD}:/nimplant ${{ vars.DOCKERHUB_USERNAME }}/nimplant:${{ steps.set_tag.outputs.tag }} /bin/bash -c "python3 ./nimplant.py compile all ${{ matrix.language }}" | |
- name: Check if all files compiled correctly for ${{ matrix.language }} | |
uses: andstor/file-existence-action@v3 | |
with: | |
fail: true | |
files: ${{ matrix.paths }} |