diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c86a95..fa2198c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,6 @@ jobs: strategy: matrix: project: - - core - core18 - core20 steps: @@ -34,6 +33,24 @@ jobs: name: 'snap' path: ${{ steps.snapcraft.outputs.snap}} + integration-legacy: # make sure the action works on a clean machine without building + runs-on: ubuntu-latest + strategy: + matrix: + project: + - core + steps: + - uses: actions/checkout@v2 + - uses: ./ + id: snapcraft + with: + path: './test-projects/${{ matrix.project }}' + snapcraft-channel: 4.x/stable + - uses: actions/upload-artifact@v2 + with: + name: 'snap' + path: ${{ steps.snapcraft.outputs.snap}} + check-runner: # make sure the action works on each VM image strategy: matrix: diff --git a/dist/index.js b/dist/index.js index bcff02f..ae88a3d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1620,7 +1620,17 @@ function ensureLXD() { // Ensure that the "lxd" group exists const haveSnapLXD = yield haveExecutable('/snap/bin/lxd'); Object(core.info)('Installing LXD...'); - yield Object(exec.exec)('sudo', ['snap', haveSnapLXD ? 'refresh' : 'install', 'lxd']); + if (haveSnapLXD) { + try { + yield Object(exec.exec)('sudo', ['snap', 'refresh', 'lxd']); + } + catch (err) { + Object(core.info)("LXD could not be refreshed..."); + } + } + else { + yield Object(exec.exec)('sudo', ['snap', 'install', 'lxd']); + } Object(core.info)('Initialising LXD...'); yield Object(exec.exec)('sudo', ['lxd', 'init', '--auto']); }); diff --git a/src/tools.ts b/src/tools.ts index c8c45cb..2f48d6d 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -49,7 +49,15 @@ export async function ensureLXD(): Promise { // Ensure that the "lxd" group exists const haveSnapLXD = await haveExecutable('/snap/bin/lxd') core.info('Installing LXD...') - await exec.exec('sudo', ['snap', haveSnapLXD ? 'refresh' : 'install', 'lxd']) + if (haveSnapLXD) { + try { + await exec.exec('sudo', ['snap', 'refresh', 'lxd']) + } catch (err) { + core.info('LXD could not be refreshed...') + } + } else { + await exec.exec('sudo', ['snap', 'install', 'lxd']) + } core.info('Initialising LXD...') await exec.exec('sudo', ['lxd', 'init', '--auto']) }