Skip to content

Commit

Permalink
GHA DEBUGGING
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
  • Loading branch information
flichtenheld committed Dec 17, 2024
1 parent a6eda5f commit 5a2b8c4
Showing 1 changed file with 32 additions and 115 deletions.
147 changes: 32 additions & 115 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,29 @@ jobs:
- name: Get artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: "*-amd64"
path: msi

- name: Run AWS test
working-directory: openvpn-windows-test
shell: pwsh
run: |
Install-Module -Name AWS.Tools.Installer -Force
Install-AWSToolsModule AWS.Tools.EC2 -Force
.\Start-AWSTest.ps1 -SSH_KEY ~/.ssh/id_rsa -MSI_PATH $(Get-ChildItem ../msi/*-amd64/*.msi | select -ExpandProperty FullName)
- name: Archive openvpn logs
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ always() }}
with:
name: t_client_openvpn_logs
path: openvpn-windows-test/openvpn-logs.zip
# - name: Run AWS test
# working-directory: openvpn-windows-test
# shell: pwsh
# run: |
# Install-Module -Name AWS.Tools.Installer -Force
# Install-AWSToolsModule AWS.Tools.EC2 -Force
# .\Start-AWSTest.ps1 -SSH_KEY ~/.ssh/id_rsa -MSI_PATH $(Get-ChildItem ../msi/*-amd64/*.msi | select -ExpandProperty FullName)

# - name: Archive openvpn logs
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
# if: ${{ always() }}
# with:
# name: t_client_openvpn_logs
# path: openvpn-windows-test/openvpn-logs.zip

upload_msis:
needs: run_tclient_tests
name: upload-msis
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'openvpn/openvpn-build' }}
if: ${{ github.event_name != 'pull_request' && github.repository == 'openvpn/openvpn-build' }}

steps:
- name: Install knock
Expand All @@ -146,112 +147,28 @@ jobs:
with:
path: msi

- name: Flatter and rename artifacts
- name: Flatten and rename artifacts
working-directory: msi
run: |
find -name '*.msi' -printf "%p\n" | while read f; do mv $f $(dirname $f).msi; rm -rf $(dirname $f); done
find
find -name '*.msi' -printf "%p\n" | while read f; do mv -v $f $(dirname $f).msi; rm -rvf $(dirname $f); done
rm -rf t_client_openvpn_logs
rm -rf openvpn-debian
find
- name: Knock ports on remote
run: knock -d 500 ${{ secrets.MSI_UPLOAD_REMOTE_HOST }} ${{ secrets.MSI_UPLOAD_REMOTE_KNOCK_SEQUENCE }} ; sleep 1

- name: Copy MSI to remote
uses: garygrossgarten/github-action-scp@2d32ef6b45d73b9df04aac224c0839f70d5e39d6 # 0.9.0
with:
local: msi
remote: ${{ secrets.MSI_UPLOAD_REMOTE_PATH }}
host: ${{ secrets.MSI_UPLOAD_REMOTE_HOST }}
port: ${{ secrets.MSI_UPLOAD_REMOTE_PORT }}
username: ${{ secrets.MSI_UPLOAD_USERNAME }}
privateKey: ${{ secrets.MSI_UPLOAD_PRIVATE_KEY }}
passphrase: ${{ secrets.MSI_UPLOAD_KEY_PASSPHRASE }}

debian:
name: Build Debian packages
runs-on: ubuntu-latest
env:
CHROOT_CONF: chroots/chroot.d.tar
OPENVPN_CURRENT_TAG: HEAD
OPENVPN_DCO_CURRENT_TAG: HEAD
USE_LOCAL_SOURCE: 1

steps:
- name: Checkout openvpn-build
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
submodules: true

- name: Install dependencies
run: |
sudo apt-get update
# for sbuild
sudo apt-get install -y sbuild git quilt debhelper dkms
# for ./configure && make dist
sudo apt-get install -y autoconf automake libcap-ng-dev libssl-dev python3-docutils
- name: Prepare release files
working-directory: release
run: |
ln -s vars.example vars
mkdir ../output
# we need to have ability to git tag the versions
# we do not push those tags
git config --global user.name "gha_user"
git config --global user.email "gha@openvpn.invalid"
./version-and-tags.sh
./create-release-files.sh
# So that the caches expire after a while
- name: Get Date for cache key
id: get-date
run: |
echo "date=$(/bin/date -u '+%Y%m')" >> $GITHUB_OUTPUT
- name: Restore cached chroots
id: chroots-restore
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: |
debian-sbuild/chroots
key: chroots-${{ hashFiles('**/config/variants.amd64.conf') }}-${{ steps.get-date.outputs.date }}
restore-keys: |
chroots-${{ hashFiles('**/config/variants.amd64.conf') }}-
chroots-
- name: Prepare environment
working-directory: debian-sbuild
run: |
[ ! -f "$CHROOT_CONF" ] || ( tar -xvf "$CHROOT_CONF" -C chroots; sudo install -m644 chroots/chroot.d/* /etc/schroot/chroot.d/ )
sudo chown root:root chroots/*.tar.gz || true
scripts/setup.sh
sudo scripts/setup_chroots.sh
sudo scripts/update-all.sh
sudo sbuild-adduser runner
tar -cvf "$CHROOT_CONF" -C /etc/schroot/ chroot.d/
- name: Save chroots
if: steps.chroots-restore.outputs.cache-hit != 'true'
id: chroots-save
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: |
debian-sbuild/chroots
key: ${{ steps.chroots-restore.outputs.cache-primary-key }}

- name: Prepare package build
working-directory: debian-sbuild
run: |
scripts/prepare-all.sh
- name: Build packages
working-directory: debian-sbuild
working-directory: msi
run: |
sg sbuild ./scripts/build-all.sh
- name: Archive packages
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: openvpn-debian
path: |
output
set -x
eval $(ssh-agent -s)
mkdir -v -m 700 $HOME/.ssh
ssh-keyscan -H ${{ secrets.MSI_UPLOAD_REMOTE_HOST }} > $HOME/.ssh/known_hosts
echo "${{ secrets.MSI_UPLOAD_PRIVATE_KEY }}" > $HOME/.ssh/key
chmod 400 $HOME/.ssh/key
echo "echo ${{ secrets.MSI_UPLOAD_KEY_PASSPHRASE }}" > $HOME/.ssh_askpass
chmod +x $HOME/.ssh_askpass
SSH_ASKPASS_REQUIRE=force SSH_ASKPASS=~/.ssh_askpass ssh-add $HOME/.ssh/key
scp -i $HOME/.ssh/key *.msi ${{ secrets.MSI_UPLOAD_USERNAME }}@${{ secrets.MSI_UPLOAD_REMOTE_HOST }}:${{ secrets.MSI_UPLOAD_REMOTE_PATH }}

0 comments on commit 5a2b8c4

Please sign in to comment.