Skip to content

Commit

Permalink
Merge branch 'main' into nomore-docker-here
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-cal authored Oct 7, 2024
2 parents b4c638a + 0633e5a commit a299b75
Show file tree
Hide file tree
Showing 88 changed files with 1,180 additions and 4,618 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you followed the [guidelines for contributing](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `tox run -m lint`?
- [ ] Have you successfully run `tox run -e test-py310`? (supported versions: `py39`, `py310`, `py311`, `py312`)
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- "feature/**"
# allow manual re-publishing as branches expire after 30 days
workflow_dispatch:

jobs:
publish:
Expand All @@ -29,7 +31,7 @@ jobs:
fetch-depth: 0

- if: steps.decisions.outputs.PUBLISH == 'true'
uses: snapcore/action-build@v1
uses: canonical/action-build@v1
name: Build Snapcraft Snap
id: build
with:
Expand All @@ -54,7 +56,7 @@ jobs:
- name: Publish feature branch to edge/${{ steps.vars.outputs.branch }}
if: steps.decisions.outputs.PUBLISH == 'true'
uses: snapcore/action-publish@v1
uses: canonical/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/security-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Security scan
on:
pull_request:
push:
branches:
- main
- hotfix/*
- work/secscan # For development

jobs:
python-scans:
name: Scan Python project
uses: canonical/starflow/.github/workflows/scan-python.yaml@main
with:
packages: python-apt-dev
osv-extra-args: '--config=source/osv-scanner.toml'
trivy-extra-args: '--severity HIGH,CRITICAL --ignore-unfixed --skip-dirs "tests/spread/**"'
2 changes: 1 addition & 1 deletion .github/workflows/spread-scheduled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
fetch-depth: 0
- name: Build snap
uses: snapcore/action-build@v1
uses: canonical/action-build@v1
id: snapcraft
- name: Upload snap artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spread.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- name: Build snapcraft snap
id: build-snapcraft
uses: snapcore/action-build@v1
uses: canonical/action-build@v1

- name: Upload snapcraft snap
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "tests/spread/tools/snapd-testing-tools"]
path = tests/spread/tools/snapd-testing-tools
url = https://github.com/snapcore/snapd-testing-tools.git
url = https://github.com/canonical/snapd-testing-tools.git
[submodule "docs/sphinx-resources"]
path = docs/sphinx-resources
url = https://github.com/canonical/sphinx-docs-starter-pack.git
78 changes: 0 additions & 78 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We want to make sure everyone develops using a consistent base, to ensure that t
Clone the snapcraft repository and its submodules and make it your working directory:

```shell
git clone https://github.com/snapcore/snapcraft.git --recurse-submodules
git clone https://github.com/canonical/snapcraft.git --recurse-submodules
cd snapcraft
```

Expand Down Expand Up @@ -98,14 +98,15 @@ tox run -e lint-codespell

## Evaluating pull requests

Oftentimes all you want to do is see if a given pull request solves the issue you were having. To make this easier, the Travis CI setup for snapcraft _publishes_ the resulting snap that was built for x86-64 using `transfer.sh`.
To download the snap, find the relevant CI job run for the PR under review and locate the "snap" stage, the URL to download from will be located at the end of logs for that job.
Oftentimes all you want to do is see if a given pull request solves the issue you were having. To make this easier, a snap is published for `amd64` on a channel named `latest/edge/pr-<PR number>` where `PR number` is the number of the pull request.

For feature branches, a snap is published for `amd64` on a channel named `latest/edge/<branch name>`. For example, a branch named `feature/offline-mode` would be available on the channel `latest/edge/offline-mode`.

## Reaching out

We'd love the help!

- Submit pull requests against [snapcraft](https://github.com/snapcore/snapcraft/pulls)
- Submit pull requests against [snapcraft](https://github.com/canonical/snapcraft/pulls)
- Make sure to read the [contribution guide](CONTRIBUTING.md)
- Find us under the snapcraft category of the forum https://forum.snapcraft.io
- Discuss with us using IRC in #snapcraft on Freenode.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
include schema/*
include extensions/*
include debian/changelog
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![snapcraft](https://snapcraft.io/snapcraft/badge.svg)](https://snapcraft.io/snapcraft)
[![Build Status][travis-image]][travis-url]
[![Documentation Status](https://readthedocs.com/projects/canonical-snapcraft/badge/?version=latest)](https://canonical-snapcraft.readthedocs-hosted.com/en/latest/?badge=latest)
[![Scheduled spread tests](https://github.com/snapcore/snapcraft/actions/workflows/spread-scheduled.yaml/badge.svg?branch=main)](https://github.com/snapcore/snapcraft/actions/workflows/spread-scheduled.yaml)
[![Scheduled spread tests](https://github.com/canonical/snapcraft/actions/workflows/spread-scheduled.yaml/badge.svg?branch=main)](https://github.com/canonical/snapcraft/actions/workflows/spread-scheduled.yaml)
[![Coverage Status][codecov-image]][codecov-url]
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

Expand Down Expand Up @@ -29,8 +28,5 @@ Learn about the latest features by following Snapcraft on
We love contributors. Read the [hacking guide](HACKING.md) if you're interested in helping out.


[travis-image]: https://travis-ci.org/snapcore/snapcraft.svg?branch=master
[travis-url]: https://travis-ci.org/snapcore/snapcraft

[codecov-image]: https://codecov.io/github/snapcore/snapcraft/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/snapcore/snapcraft?branch=master
[codecov-image]: https://codecov.io/github/canonical/snapcraft/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/canonical/snapcraft?branch=master
39 changes: 1 addition & 38 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ These tests are in the `tests/integration` directory, with the `snapcraft.yamls`
At any time, an integration test may fail and given the use of temporary directories it can be hard to inspect what went on. When working on a specific test case you can set the environment variable `SNAPCRAFT_TEST_KEEP_DATA_PATH` to a directory path for the sepecic test.
This mechanism will only work when working with individual tests and will fail to run with a batch of them.

### Slow tests

Some tests take too long. This affects the pull requests because we have to wait for a long time, and they will make Travis CI timeout because we have only 50 minutes per suite in there. The solution is to tag these tests as slow, and don't run them in all pull requests. These tests will only be run in autopkgtests.

To mark a test case as slow, set the class attribute `slow_test = True`.

To run all the tests, including the slow ones, set the environment variable `SNAPCRAFT_SLOW_TESTS=1`.

### Snaps tests

The snaps tests is a suite of high-level tests that try to simulate real-world scenarios of a user interacting with snapcraft. They cover the call to snapcraft to generate a snap file from the source files of a fully functional project, the installation of the resulting snap, and the execution of the binaries and services of this snap.
Expand Down Expand Up @@ -120,38 +112,9 @@ We can currently run a minimal subset of snapcraft integration tests on macOS. T

For manual exploratory testing, the team has one mac machine available.

## Autopkgtests for the snapcraft deb

Autopkgtests are tests for the project packaged as a deb. The unit tests are run during autopkgtests while the snapcraft deb is being built. Then the resulting deb is installed, and the integration and snaps suites are executed using the installed snapcraft.


### How to run on Xenial

The easiest way is to use a LXC container. From the root of the project, run:

sudo apt install autopkgtest
adt-run --unbuilt-tree . --apt-upgrade --- lxd ubuntu:xenial

It's possible to select only one of the suites using `--testname`, for example:

adt-run --unbuilt-tree . --apt-upgrade --testname=integrationtests --- lxd ubuntu:xenial


### How to run on Bionic

The easiest way is to use a LXC container. From the root of the project, run:

sudo apt install autopkgtest
autopkgtest . -U -- lxd ubuntu:xenial

It's possible to select only one of the suites using `--test-name`, for example:

autopkgtest . -U --test-name=integrationtests-spread -- lxd ubuntu:xenial


## Spread tests for the snapcraft snap

[Spread](https://github.com/snapcore/spread) is a system to distribute tests and execute them in different backends, in parallel. We are currently using spread only to run the integration suite using the installed snapcraft snap from the edge channel.
[Spread](https://github.com/canonical/spread) is a system to distribute tests and execute them in different backends, in parallel. We are currently using spread only to run the integration suite using the installed snapcraft snap from the edge channel.

To run them, first, download the spread binary:

Expand Down
Loading

0 comments on commit a299b75

Please sign in to comment.