name: WANessa CI run-name: Running build for ${{ gitea.actor }} on: [push] jobs: main: runs-on: ubuntu-latest steps: - name: Setup Rust uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable components: rustfmt, clippy - name: Check out repository code uses: actions/checkout@v3 - name: Run build uses: actions-rs/cargo@v1 with: command: build args: --all - name: Run tests uses: actions-rs/cargo@v1 with: command: test args: --all - name: Run clippy lint checks uses: actions-rs/cargo@v1 with: command: clippy args: --all - name: Make docs uses: actions-rs/cargo@v1 with: command: doc args: --all - name: Format project with rustfmt run: | # Run format or exit if not required #cargo fmt --all --check && echo "No formatting required, exiting early..." && exit 0 cargo fmt --all --verbose # Check for format loop '[ "$(git log -1 --pretty=%B | grep -E ".+")" = "rustfmt" ] && echo "format loop detected, aborting..." && exit 1' # configure SSH and import private key mkdir -p "$${HOME}/.ssh" echo "${{ secrets.WANESSA_SSH_PRIVKEY }}" > "$${HOME}/.ssh/git" echo "Host git.libre.moe" >> "$${HOME}/.ssh/config" echo " User git" >> "$${HOME}/.ssh/config" echo " IdentityFile $${HOME}/.ssh/git" >> "$${HOME}/.ssh/config" echo "${{ secrets.GIT_ED25519_SIG }}" >> "$${HOME}/.ssh/known_hosts" echo "${{ secrets.GIT_RSA_SIG }}" >> "$${HOME}/.ssh/known_hosts" echo "${{ secrets.GIT_ECDSA_SIG }}" >> "$${HOME}/.ssh/known_hosts" chmod 700 -R "$${HOME}/.ssh" # setup gpg gpg-agent --daemon # the git config gpg.program absolutely despises anything other than a path, including additional arguments. # so we just put it into it's own shell script and use that later echo "#!/bin/sh" >> /tmp/gpg.sh echo gpg --batch --pinentry-mode loopback --passphrase '${{ secrets.WANESSA_GPG_PASSPHRASE }}' \$@ >> /tmp/gpg.sh chmod 777 /tmp/gpg.sh # import gpg key echo "${{ secrets.WANESSA_GPG_PRIVKEY }}" > /tmp/private.key /tmp/gpg.sh --import /tmp/private.key >> /tmp/import.sh || exit 2 # configure git git config --local user.name "WANessa" git config --local user.email "${{ secrets.WANESSA_EMAIL_ADDRESS }}" git config --local user.signingkey "${{ secrets.WANESSA_GPG_PUBKEY_ID }}" git config --local gpg.program "/tmp/gpg.sh" # see above comment # Uncomment below line for ssh debugging # - git config core.sshCommand '/usr/bin/ssh -v' git remote add ssh "${{ secrets.GIT_SSH_URL }}" # commit and push every modified file, does not include new files, because why should it? - git commit --author "WANessa <${{ secrets.WANESSA_EMAIL_ADDRESS }}>" -S -a -m "rustfmt" - git push ssh