CI: add a fantomas step #52
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: CI | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
container: | |
image: "ubuntu:22.04" | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install required dependencies | |
run: | | |
apt update | |
apt install --yes sudo | |
sudo apt install --yes --no-install-recommends git | |
# workaround for https://github.com/actions/runner/issues/2033 | |
git config --global --add safe.directory '*' | |
- name: Setup .NET | |
run: | | |
# We need to install `ca-certificates`, otherwise we get these errors in the CI: | |
# Unable to load the service index for source https://api.nuget.org/v3/index.json. | |
# The SSL connection could not be established, see inner exception. | |
# The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot | |
apt install --yes --no-install-recommends ca-certificates | |
apt install --yes --no-install-recommends dotnet7 | |
- name: Build | |
run: dotnet build | |
build_snap: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install snap tools | |
run: | | |
sudo apt update | |
sudo apt install -y snapd | |
snap version | |
sudo snap install --classic snapcraft | |
# workaround for GithubActionsCI+snapcraft, see https://forum.snapcraft.io/t/permissions-problem-using-snapcraft-in-azure-pipelines/13258/14 | |
sudo chown root:root / | |
snapcraft --version | |
# use multipass provider as lxd doesn't work for some reason | |
sudo snap install multipass | |
sudo snap set snapcraft provider=multipass | |
- name: Build | |
run: dotnet build --configuration Release | |
- name: Generate snap package | |
run: sudo snapcraft --destructive-mode --verbosity=verbose || sudo bash -c 'cat /root/.local/state/snapcraft/log/*.log' | |
- uses: actions/upload-artifact@v3 | |
name: Upload snap package as artifact | |
with: | |
name: snap | |
path: ./*.snap | |
integration_tests: | |
strategy: | |
matrix: | |
# macos-13 is x64 and macos-14 is arm64 | |
os: [ubuntu-22.04, macos-13, macos-14, windows-latest] | |
needs: build | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Run Tests | |
run: dotnet test | |
run_snap: | |
needs: build_snap | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/download-artifact@v3 | |
name: Download artifact | |
with: | |
name: snap | |
- name: Install snap | |
run: | | |
zip -r snap.zip . | |
# dangerous because it's a local snap (not one from the SnapStore) | |
sudo snap install --devmode --dangerous *.snap | |
- name: Test snap | |
run: packwallet | |
conventions: | |
needs: | |
- integration_tests | |
- run_snap | |
runs-on: ubuntu-22.04 | |
container: | |
image: "ubuntu:22.04" | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install required dependencies | |
run: | | |
apt update | |
apt install --yes sudo | |
sudo apt install --yes --no-install-recommends git | |
# workaround for https://github.com/actions/runner/issues/2033 | |
git config --global --add safe.directory '*' | |
- name: Setup .NET | |
run: | | |
# We need to install `ca-certificates`, otherwise we get these errors in the CI: | |
# Unable to load the service index for source https://api.nuget.org/v3/index.json. | |
# The SSL connection could not be established, see inner exception. | |
# The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot | |
apt install --yes --no-install-recommends ca-certificates | |
apt install --yes --no-install-recommends dotnet6 | |
- name: fantomas | |
run: | | |
dotnet new tool-manifest | |
dotnet tool install fantomas --version 6.2.3 | |
dotnet fantomas . | |
git diff --exit-code | |