From a6893cc2d402fbf18f2c56b3dbc81cda0364df04 Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Wed, 11 Oct 2023 17:52:29 +0900 Subject: [PATCH 1/4] feat: extract binary actions: Initial --- .github/workflows/release.yml | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..91dd18b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release +on: + push: + # workflow_run: + # workflows: + # - "Build and Publish Docker" + # - "Unit Test" + # types: + # - "completed" + # branches: + # - "main" + # - "develop" + +jobs: + on-success: + runs-on: ubuntu-latest + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + strategy: + fail-fast: false + matrix: + include: + - target: "gnu" + platform: linux/amd64 + + - target: "gnu" + platform: linux/arm64 + + - target: "musl" + platform: linux/amd64 + tags-suffix: "-slim" + + - target: "musl" + platform: linux/arm64 + tags-suffix: "-slim" + + - target: "gnu-s2n" + platform: linux/amd64 + tags-suffix: "-s2n" + + - target: "gnu-s2n" + platform: linux/arm64 + tags-suffix: "-s2n" + + steps: + - run: echo 'The relese triggering workflows passed' + + - name: "docker pull and extract binary from docker image" + # if: ${{ github.ref_name == 'develop' }} + run: | + CONTAINER_ID=`docker create --platform=${{ matrix.platform }} ghcr.io/junkurihara/rust-rpxy:nightly${{ matrix.tags-suffix }}` + if [ ${{ matrix.platform }} = "linux/amd64" ];then PLATFORM_MAP="x86_64";else PLATFORM_MAP="aarch64";fi + docker cp ${CONTAINER_ID}:/rpxy/bin/rpxy /tmp/rpxy-nightly-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}-${{ matrix.tags-suffix }} + ls /tmp + + # on-failure: + # runs-on: ubuntu-latest + # if: ${{ github.event.workflow_run.conclusion == 'failure' }} + # steps: + # - run: echo 'The release triggering workflows failed' From ef0c92ce0997d8127d5ca676807c7ca00e828d54 Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Wed, 11 Oct 2023 20:08:12 +0900 Subject: [PATCH 2/4] feat: extract binary actions: temporary upload to artifact --- .github/workflows/release.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 91dd18b..a6a252c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: Extract executable binary and upload artifacts on: push: # workflow_run: @@ -42,15 +42,29 @@ jobs: tags-suffix: "-s2n" steps: - - run: echo 'The relese triggering workflows passed' + - run: "echo 'The relese triggering workflows passed'" + + - name: "set env" + #if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="-nightly";else BUILD_NAME="";fi + run: | + if [ ${{ matrix.platform }} = "linux/amd64" ];then PLATFORM_MAP="x86_64";else PLATFORM_MAP="aarch64";fi + echo "PLATFORM_MAP=${PLATFORM_MAP}" >> $GITHUB_ENV + echo "TARGET_NAME=rpxy-nightly-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}" >> $GITHUB_ENV - name: "docker pull and extract binary from docker image" - # if: ${{ github.ref_name == 'develop' }} + id: "extract-binary" run: | CONTAINER_ID=`docker create --platform=${{ matrix.platform }} ghcr.io/junkurihara/rust-rpxy:nightly${{ matrix.tags-suffix }}` - if [ ${{ matrix.platform }} = "linux/amd64" ];then PLATFORM_MAP="x86_64";else PLATFORM_MAP="aarch64";fi - docker cp ${CONTAINER_ID}:/rpxy/bin/rpxy /tmp/rpxy-nightly-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}-${{ matrix.tags-suffix }} - ls /tmp + docker cp ${CONTAINER_ID}:/rpxy/bin/rpxy /tmp/${TARGET_NAME} + cd /tmp + tar zcvf ${TARGET_NAME}.tar.gz ${TARGET_NAME} + echo "artifact=${TARGET_NAME}" >> $GITHUB_OUTPUT + + - name: "upload artifacts" + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.extract-binary.outputs.artifact }} + path: "/tmp/${{ steps.extract-binary.outputs.artifact }}.tar.gz" # on-failure: # runs-on: ubuntu-latest From b4792451ab7608a121a2968a40242a2d166195cb Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Wed, 11 Oct 2023 20:48:50 +0900 Subject: [PATCH 3/4] feat: automatic draft release --- .github/workflows/docker_build_push.yml | 2 + .github/workflows/release.yml | 73 +++++++++++++++++++++++-- CHANGELOG.md | 8 +++ rpxy-bin/Cargo.toml | 2 +- rpxy-lib/Cargo.toml | 2 +- 5 files changed, 79 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker_build_push.yml b/.github/workflows/docker_build_push.yml index c158cbe..c3cba7b 100644 --- a/.github/workflows/docker_build_push.yml +++ b/.github/workflows/docker_build_push.yml @@ -4,6 +4,8 @@ on: branches: - "develop" - "main" + tags: + - "*.*.*" pull_request: types: [synchronize, opened] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6a252c..a285aba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,23 +33,55 @@ jobs: platform: linux/arm64 tags-suffix: "-slim" - - target: "gnu-s2n" + - target: "gnu" + build-feature: "-s2n" platform: linux/amd64 tags-suffix: "-s2n" - - target: "gnu-s2n" + - target: "gnu" + build-feature: "-s2n" platform: linux/arm64 tags-suffix: "-s2n" + - target: "gnu" + build-feature: "-native-roots" + platform: linux/amd64 + tags-suffix: "-native-roots" + + - target: "gnu" + build-feature: "-native-roots" + platform: linux/arm64 + tags-suffix: "-native-roots" + + - target: "musl" + build-feature: "-native-roots" + platform: linux/amd64 + tags-suffix: "-slim-native-roots" + + - target: "musl" + build-feature: "-native-roots" + platform: linux/arm64 + tags-suffix: "-slim-native-roots" + + - target: "gnu" + build-feature: "-s2n-native-roots" + platform: linux/amd64 + tags-suffix: "-s2n-native-roots" + + - target: "gnu" + build-feature: "-s2n-native-roots" + platform: linux/arm64 + tags-suffix: "-s2n-native-roots" + steps: - run: "echo 'The relese triggering workflows passed'" - name: "set env" - #if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="-nightly";else BUILD_NAME="";fi + #if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="rpxy-nightly";else BUILD_NAME="rpxy";fi run: | if [ ${{ matrix.platform }} = "linux/amd64" ];then PLATFORM_MAP="x86_64";else PLATFORM_MAP="aarch64";fi echo "PLATFORM_MAP=${PLATFORM_MAP}" >> $GITHUB_ENV - echo "TARGET_NAME=rpxy-nightly-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}" >> $GITHUB_ENV + echo "TARGET_NAME=rpxy-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_ENV - name: "docker pull and extract binary from docker image" id: "extract-binary" @@ -57,17 +89,46 @@ jobs: CONTAINER_ID=`docker create --platform=${{ matrix.platform }} ghcr.io/junkurihara/rust-rpxy:nightly${{ matrix.tags-suffix }}` docker cp ${CONTAINER_ID}:/rpxy/bin/rpxy /tmp/${TARGET_NAME} cd /tmp - tar zcvf ${TARGET_NAME}.tar.gz ${TARGET_NAME} echo "artifact=${TARGET_NAME}" >> $GITHUB_OUTPUT - name: "upload artifacts" uses: actions/upload-artifact@v3 with: name: ${{ steps.extract-binary.outputs.artifact }} - path: "/tmp/${{ steps.extract-binary.outputs.artifact }}.tar.gz" + path: "/tmp/${{ steps.extract-binary.outputs.artifact }}" # on-failure: # runs-on: ubuntu-latest # if: ${{ github.event.workflow_run.conclusion == 'failure' }} # steps: # - run: echo 'The release triggering workflows failed' + + release: + runs-on: ubuntu-latest + # if: startsWith(github.ref, 'refs/tags/') + needs: on-success + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: download artifacts + uses: actions/download-artifact@v3 + with: + path: /tmp/rpxy + + - name: make tar.gz of assets + run: | + mkdir /tmp/assets + cd /tmp/rpxy + for i in ./*; do sh -c "cd $i && tar zcvf $i.tar.gz $i && mv $i.tar.gz /tmp/assets/"; done + ls -lha /tmp/assets + + # - name: release + # uses: softprops/action-gh-release@v1 + # if: startsWith(github.ref, 'refs/tags/') + # with: + # files: /tmp/assets/*.tar.gz + # tag_name: ${{ github.ref }} + # draft: true + # prerelease: false + # generate_release_notes: true diff --git a/CHANGELOG.md b/CHANGELOG.md index a7c171f..20ac679 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## 0.7.0 (unreleased) +## 0.6.2 + +### Improvement + +- Feat: Add a build feature of `native-roots` to use the system's default root cert store. +- Feat: Add binary release in addition to container release +- Refactor: lots of minor improvements + ## 0.6.1 ### Bugfix diff --git a/rpxy-bin/Cargo.toml b/rpxy-bin/Cargo.toml index 98ff827..fbe14dc 100644 --- a/rpxy-bin/Cargo.toml +++ b/rpxy-bin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rpxy" -version = "0.6.1" +version = "0.6.2" authors = ["Jun Kurihara"] homepage = "https://github.com/junkurihara/rust-rpxy" repository = "https://github.com/junkurihara/rust-rpxy" diff --git a/rpxy-lib/Cargo.toml b/rpxy-lib/Cargo.toml index 0b0d3ee..c7cce09 100644 --- a/rpxy-lib/Cargo.toml +++ b/rpxy-lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rpxy-lib" -version = "0.6.1" +version = "0.6.2" authors = ["Jun Kurihara"] homepage = "https://github.com/junkurihara/rust-rpxy" repository = "https://github.com/junkurihara/rust-rpxy" From 22f647cb2a07cdcc94e9427f76444c2e036143c5 Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Wed, 11 Oct 2023 22:28:18 +0900 Subject: [PATCH 4/4] feat: automatic draft release updated --- .github/workflows/ci.yml | 16 ++++---- .github/workflows/docker_build_push.yml | 4 +- .github/workflows/release.yml | 54 +++++++++++-------------- 3 files changed, 32 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b578d4b..d9c9478 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,22 +2,20 @@ name: Unit Test on: push: - branches: [ main, develop ] pull_request: - branches: [ main, develop ] + types: [synchronize, opened] env: CARGO_TERM_COLOR: always jobs: test: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Run unit tests - run: | - cargo test --verbose + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Run unit tests + run: | + cargo test --verbose diff --git a/.github/workflows/docker_build_push.yml b/.github/workflows/docker_build_push.yml index c3cba7b..7f96aa8 100644 --- a/.github/workflows/docker_build_push.yml +++ b/.github/workflows/docker_build_push.yml @@ -1,4 +1,4 @@ -name: Build and Publish Docker +name: Build and publish docker on: push: branches: @@ -6,8 +6,6 @@ on: - "main" tags: - "*.*.*" - pull_request: - types: [synchronize, opened] env: GHCR: ghcr.io diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a285aba..ec075c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,15 @@ -name: Extract executable binary and upload artifacts +name: Extract executable binary, upload artifacts, create release on: - push: - # workflow_run: - # workflows: - # - "Build and Publish Docker" - # - "Unit Test" - # types: - # - "completed" - # branches: - # - "main" - # - "develop" + workflow_run: + workflows: + - "Build and publish docker" + types: + - "completed" jobs: on-success: runs-on: ubuntu-latest - # if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event.workflow_run.conclusion == 'success' }} strategy: fail-fast: false matrix: @@ -75,13 +70,12 @@ jobs: steps: - run: "echo 'The relese triggering workflows passed'" - - name: "set env" - #if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="rpxy-nightly";else BUILD_NAME="rpxy";fi run: | if [ ${{ matrix.platform }} = "linux/amd64" ];then PLATFORM_MAP="x86_64";else PLATFORM_MAP="aarch64";fi + if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="rpxy-nightly";else BUILD_NAME="rpxy";fi echo "PLATFORM_MAP=${PLATFORM_MAP}" >> $GITHUB_ENV - echo "TARGET_NAME=rpxy-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_ENV + echo "TARGET_NAME=${BUILD_NAME}-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_ENV - name: "docker pull and extract binary from docker image" id: "extract-binary" @@ -97,15 +91,15 @@ jobs: name: ${{ steps.extract-binary.outputs.artifact }} path: "/tmp/${{ steps.extract-binary.outputs.artifact }}" - # on-failure: - # runs-on: ubuntu-latest - # if: ${{ github.event.workflow_run.conclusion == 'failure' }} - # steps: - # - run: echo 'The release triggering workflows failed' + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: echo 'The release triggering workflows failed' release: runs-on: ubuntu-latest - # if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') needs: on-success steps: - name: checkout @@ -123,12 +117,12 @@ jobs: for i in ./*; do sh -c "cd $i && tar zcvf $i.tar.gz $i && mv $i.tar.gz /tmp/assets/"; done ls -lha /tmp/assets - # - name: release - # uses: softprops/action-gh-release@v1 - # if: startsWith(github.ref, 'refs/tags/') - # with: - # files: /tmp/assets/*.tar.gz - # tag_name: ${{ github.ref }} - # draft: true - # prerelease: false - # generate_release_notes: true + - name: release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: /tmp/assets/*.tar.gz + tag_name: ${{ github.ref }} + draft: true + prerelease: false + generate_release_notes: true