Skip to content

Commit

Permalink
Merge branch 'master' into allow_add_component_to_publish_switch
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx authored Sep 24, 2024
2 parents 609af87 + eaa363e commit 7cf7d11
Show file tree
Hide file tree
Showing 71 changed files with 1,686 additions and 674 deletions.
8 changes: 6 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.go
.git
.go/
.git/
obj-x86_64-linux-gnu/
unit.out
aptly.test
build/
231 changes: 167 additions & 64 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Based on https://github.com/aptly-dev/aptly/blob/master/.travis.yml

name: CI

on:
Expand All @@ -13,14 +11,14 @@ on:
defaults:
run:
# see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash --noprofile --norc -eo pipefail {0}

env:
DEBIAN_FRONTEND: noninteractive

jobs:
build:
name: test
test:
name: "System Tests (Ubuntu 22.04)"
runs-on: ubuntu-22.04
continue-on-error: false
timeout-minutes: 30
Expand All @@ -30,39 +28,43 @@ jobs:
BOTO_CONFIG: /dev/null
GO111MODULE: "on"
GOPROXY: "https://proxy.golang.org"
GOVER: '1.22'

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: "Install packages"
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends graphviz gnupg2 gpgv2 git gcc make devscripts
- name: Setup Go
uses: actions/setup-go@v3
- name: "Checkout repository"
uses: actions/checkout@v3
with:
go-version: ${{ env.GOVER }}
# fetch the whole repo for `git describe` to work
fetch-depth: 0

- name: Get aptly version
- name: "Read go version from go.mod"
run: |
make version
go generate
gover=$(sed -n 's/^go \(.*\)/\1/p' go.mod)
echo "Go Version: $gover"
echo "GOVER=$gover" >> $GITHUB_OUTPUT
id: goversion

- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: ${{ steps.goversion.outputs.GOVER }}

- name: Setup Python
- name: "Setup Python"
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install O/S packages
run: |
sudo apt-get update
sudo apt-get install -y graphviz gnupg2 gpgv2 git gcc make
- name: Install Python packages
- name: "Install Python packages"
run: |
pip install six packaging appdirs virtualenv
pip install -U pip setuptools
pip install -r system/requirements.txt
- name: Install Azurite
- name: "Install Azurite"
id: azuright
uses: potatoqualitee/[email protected]
with:
Expand All @@ -74,6 +76,8 @@ jobs:
AZURE_STORAGE_ENDPOINT: "http://127.0.0.1:10000/devstoreaccount1"
AZURE_STORAGE_ACCOUNT: "devstoreaccount1"
AZURE_STORAGE_ACCESS_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
sudo mkdir -p /srv ; sudo chown runner /srv
COVERAGE_DIR=${{ runner.temp }} make all
Expand All @@ -89,81 +93,180 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt

release:
needs: build
ci-debian-build:
name: "Build"
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name: [Ubuntu-20, Ubuntu-22, Debian-10, Debian-11, Debian-12]
name: ["Debian 13/testing", "Debian 12/bookworm", "Debian 11/bullseye", "Debian 10/buster", "Ubuntu 24.04", "Ubuntu 22.04", "Ubuntu 20.04"]
arch: ["amd64", "i386" , "arm64" , "armhf"]
include:
- name: Ubuntu-20
image: "ubuntu:20.04"
suite: focal
GOVER: '1.21'
install: "make ca-certificates git curl"
- name: Ubuntu-22
image: "ubuntu:22.04"
suite: jammy
install: "make ca-certificates git curl golang"
- name: Debian-10
image: "debian:buster"
suite: buster
GOVER: '1.21'
install: "make ca-certificates git curl"
- name: Debian-11
image: "debian:bullseye"
suite: bullseye
GOVER: '1.21'
install: "make ca-certificates git curl"
- name: Debian-12
image: "debian:bookworm"
- name: "Debian 13/testing"
suite: trixie
image: debian:trixie-slim
- name: "Debian 12/bookworm"
suite: bookworm
install: "make ca-certificates git curl golang"
image: debian:bookworm-slim
- name: "Debian 11/bullseye"
suite: bullseye
image: debian:bullseye-slim
- name: "Debian 10/buster"
suite: buster
image: debian:buster-slim
- name: "Ubuntu 24.04"
suite: noble
image: ubuntu:24.04
- name: "Ubuntu 22.04"
suite: jammy
image: ubuntu:22.04
- name: "Ubuntu 20.04"
suite: focal
image: ubuntu:20.04
container:
image: ${{ matrix.image }}
env:
APT_LISTCHANGES_FRONTEND: none
DEBIAN_FRONTEND: noninteractive
steps:
- name: Install O/S packages
- name: "Install packages"
run: |
apt-get update
apt-get install -y --no-install-recommends ${{ matrix.install }}
apt-get install -y --no-install-recommends make ca-certificates git curl build-essential devscripts dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf jq
git config --global --add safe.directory "$GITHUB_WORKSPACE"
echo GOVER: ${{ env.GOVER }}
- name: Checkout repository
- name: "Checkout repository"
uses: actions/checkout@v3
with:
# fetch the whole repo for `git describe` to
# work and get the nightly verion
# fetch the whole repo for `git describe` to work
fetch-depth: 0

- name: Setup Go
if: ${{ matrix.GOVER != '' }}
- name: "Read go version from go.mod"
run: |
gover=$(sed -n 's/^go \(.*\)/\1/p' go.mod)
echo "Go Version: $gover"
echo "GOVER=$gover" >> $GITHUB_OUTPUT
id: goversion

- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.GOVER }}
go-version: ${{ steps.goversion.outputs.GOVER }}

- name: "Ensure CI build"
if: github.ref == 'refs/heads/master'
run: |
echo "FORCE_CI=true" >> $GITHUB_OUTPUT
id: force_ci

- name: Make Release
- name: "Build Debian packages"
env:
GOBIN: /usr/local/bin
FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
run: |
make release
make dpkg DEBARCH=${{ matrix.arch }}
- name: Publish nightly release to aptly
if: github.ref == 'refs/heads/master'
- name: "Check aptly credentials"
env:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
run: |
./upload-artifacts.sh nightly ${{ matrix.suite }}
found=no
if [ -n "$APTLY_USER" ] && [ -n "$APTLY_PASSWORD" ]; then
found=yes
fi
echo "Aptly credentials available: $found"
echo "FOUND=$found" >> $GITHUB_OUTPUT
id: aptlycreds

- name: Publish release to aptly
if: startsWith(github.event.ref, 'refs/tags')
- name: "Publish CI release to aptly"
if: github.ref == 'refs/heads/master' && steps.aptlycreds.outputs.FOUND == 'yes'
env:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
run: |
./upload-artifacts.sh ci ${{ matrix.suite }}
- name: "Publish release to aptly"
if: startsWith(github.event.ref, 'refs/tags') && steps.aptlycreds.outputs.FOUND == 'yes'
env:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
run: |
./upload-artifacts.sh release ${{ matrix.suite }}
ci-binary-build:
name: "Build"
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, freebsd, darwin]
goarch: ["386", "amd64", "arm", "arm64"]
exclude:
- goos: darwin
goarch: 386
- goos: darwin
goarch: arm
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
# fetch the whole repo for `git describe` to work
fetch-depth: 0

- name: "Read go version from go.mod"
run: |
echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT
id: goversion

- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: ${{ steps.goversion.outputs.GOVER }}

- name: "Ensure CI build"
if: github.ref == 'refs/heads/master'
run: |
echo "FORCE_CI=true" >> $GITHUB_OUTPUT
id: force_ci

- name: "Get aptly version"
env:
FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
run: |
aptlyver=$(make -s version)
echo "Aptly Version: $aptlyver"
echo "VERSION=$aptlyver" >> $GITHUB_OUTPUT
id: releaseversion

- name: "Build aptly ${{ matrix.goos }}/${{ matrix.goarch }}"
env:
GOBIN: /usr/local/bin
FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
run: |
make binaries GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}
- uses: actions/upload-artifact@v4
if: startsWith(github.event.ref, 'refs/tags')
with:
name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}
path: build/aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
compression-level: 0 # no compression

gh-release:
name: "Github Release"
runs-on: ubuntu-latest
continue-on-error: false
needs: ci-binary-build
if: startsWith(github.event.ref, 'refs/tags')
steps:
- name: "Download Artifacts"
uses: actions/download-artifact@v4
with:
path: out/

- name: "Release"
uses: softprops/action-gh-release@v2
with:
files: "out/**/aptly_*.zip"
13 changes: 10 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5

- name: "Read go version from go.mod"
run: |
echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT
id: goversion

- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: '1.21'
cache: false
go-version: ${{ steps.goversion.outputs.GOVER }}

- name: Create VERSION file
run: |
make -s version | tr -d '\n' > VERSION
Expand Down
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ root/
man/aptly.1.html
man/aptly.1.ronn

.goxc.local.json

system/env/

# created by make build for release artifacts
Expand All @@ -52,3 +50,21 @@ pgp/keyrings/.#*
*.creds

.go/
obj-x86_64-linux-gnu/

# debian
debian/.debhelper/
debian/aptly.debhelper.log
debian/aptly.postrm.debhelper
debian/aptly.substvars
debian/aptly/
debian/debhelper-build-stamp
debian/files
debian/aptly-api/
debian/aptly-api.debhelper.log
debian/aptly-api.postrm.debhelper
debian/aptly-api.substvars
debian/aptly-dbg.debhelper.log
debian/aptly-dbg.substvars
debian/aptly-dbg/

Loading

0 comments on commit 7cf7d11

Please sign in to comment.